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

Merge tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC cleanups from Olof Johansson:
"We've got a fairly large cleanup branch this time. The bulk of this
is removal of non-DT platforms of several flavors:

- Atmel at91 platforms go full-DT, with removal of remaining
board-file based support

- OMAP removes legacy board files for three more platforms

- removal of non-DT mach-msm, newer Qualcomm platforms now live in
mach-qcom

- Freescale i.MX25 also removes non-DT platform support"

Most of the rest of the changes here are fallout from the above, i.e. for
example removal of drivers that now lack platforms, etc.

* tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (58 commits)
mmc: Remove msm_sdcc driver
gpio: Remove gpio-msm-v1 driver
ARM: Remove mach-msm and associated ARM architecture code
ARM: shmobile: cpuidle: Remove the pointless default driver
ARM: davinci: dm646x: Add interrupt resource for McASPs
ARM: davinci: irqs: Correct McASP1 TX interrupt definition for DM646x
ARM: davinci: dm646x: Clean up the McASP DMA resources
ARM: davinci: devices-da8xx: Add support for McASP2 on da830
ARM: davinci: devices-da8xx: Clean up and correct the McASP device creation
ARM: davinci: devices-da8xx: Add interrupt resource to McASP structs
ARM: davinci: devices-da8xx: Add resource name for the McASP DMA request
ARM: OMAP2+: Remove legacy support for omap3 TouchBook
ARM: OMAP3: Remove legacy support for devkit8000
ARM: OMAP3: Remove legacy support for EMA-Tech Stalker board
ARM: shmobile: Consolidate the pm code for R-Car Gen2
ARM: shmobile: r8a7791: Correct SYSCIER value
ARM: shmobile: r8a7790: Correct SYSCIER value
ARM: at91: remove old setup
ARM: at91: sama5d4: remove useless map_io
ARM: at91: sama5 use SoC detection infrastructure
...

+1016 -16658
-2
Documentation/arm/00-INDEX
··· 10 10 - Intel IXP4xx Network processor. 11 11 Makefile 12 12 - Build sourcefiles as part of the Documentation-build for arm 13 - msm/ 14 - - MSM specific documentation 15 13 Netwinder 16 14 - Netwinder specific documentation 17 15 Porting
-176
Documentation/arm/msm/gpiomux.txt
··· 1 - This document provides an overview of the msm_gpiomux interface, which 2 - is used to provide gpio pin multiplexing and configuration on mach-msm 3 - targets. 4 - 5 - History 6 - ======= 7 - 8 - The first-generation API for gpio configuration & multiplexing on msm 9 - is the function gpio_tlmm_config(). This function has a few notable 10 - shortcomings, which led to its deprecation and replacement by gpiomux: 11 - 12 - The 'disable' parameter: Setting the second parameter to 13 - gpio_tlmm_config to GPIO_CFG_DISABLE tells the peripheral 14 - processor in charge of the subsystem to perform a look-up into a 15 - low-power table and apply the low-power/sleep setting for the pin. 16 - As the msm family evolved this became problematic. Not all pins 17 - have sleep settings, not all peripheral processors will accept requests 18 - to apply said sleep settings, and not all msm targets have their gpio 19 - subsystems managed by a peripheral processor. In order to get consistent 20 - behavior on all targets, drivers are forced to ignore this parameter, 21 - rendering it useless. 22 - 23 - The 'direction' flag: for all mux-settings other than raw-gpio (0), 24 - the output-enable bit of a gpio is hard-wired to a known 25 - input (usually VDD or ground). For those settings, the direction flag 26 - is meaningless at best, and deceptive at worst. In addition, using the 27 - direction flag to change output-enable (OE) directly can cause trouble in 28 - gpiolib, which has no visibility into gpio direction changes made 29 - in this way. Direction control in gpio mode should be made through gpiolib. 30 - 31 - Key Features of gpiomux 32 - ======================= 33 - 34 - - A consistent interface across all generations of msm. Drivers can expect 35 - the same results on every target. 36 - - gpiomux plays nicely with gpiolib. Functions that should belong to gpiolib 37 - are left to gpiolib and not duplicated here. gpiomux is written with the 38 - intent that gpio_chips will call gpiomux reference-counting methods 39 - from their request() and free() hooks, providing full integration. 40 - - Tabular configuration. Instead of having to call gpio_tlmm_config 41 - hundreds of times, gpio configuration is placed in a single table. 42 - - Per-gpio sleep. Each gpio is individually reference counted, allowing only 43 - those lines which are in use to be put in high-power states. 44 - - 0 means 'do nothing': all flags are designed so that the default memset-zero 45 - equates to a sensible default of 'no configuration', preventing users 46 - from having to provide hundreds of 'no-op' configs for unused or 47 - unwanted lines. 48 - 49 - Usage 50 - ===== 51 - 52 - To use gpiomux, provide configuration information for relevant gpio lines 53 - in the msm_gpiomux_configs table. Since a 0 equates to "unconfigured", 54 - only those lines to be managed by gpiomux need to be specified. Here 55 - is a completely fictional example: 56 - 57 - struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = { 58 - [12] = { 59 - .active = GPIOMUX_VALID | GPIOMUX_DRV_8MA | GPIOMUX_FUNC_1, 60 - .suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN, 61 - }, 62 - [34] = { 63 - .suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN, 64 - }, 65 - }; 66 - 67 - To indicate that a gpio is in use, call msm_gpiomux_get() to increase 68 - its reference count. To decrease the reference count, call msm_gpiomux_put(). 69 - 70 - The effect of this configuration is as follows: 71 - 72 - When the system boots, gpios 12 and 34 will be initialized with their 73 - 'suspended' configurations. All other gpios, which were left unconfigured, 74 - will not be touched. 75 - 76 - When msm_gpiomux_get() is called on gpio 12 to raise its reference count 77 - above 0, its active configuration will be applied. Since no other gpio 78 - line has a valid active configuration, msm_gpiomux_get() will have no 79 - effect on any other line. 80 - 81 - When msm_gpiomux_put() is called on gpio 12 or 34 to drop their reference 82 - count to 0, their suspended configurations will be applied. 83 - Since no other gpio line has a valid suspended configuration, no other 84 - gpio line will be effected by msm_gpiomux_put(). Since gpio 34 has no valid 85 - active configuration, this is effectively a no-op for gpio 34 as well, 86 - with one small caveat, see the section "About Output-Enable Settings". 87 - 88 - All of the GPIOMUX_VALID flags may seem like unnecessary overhead, but 89 - they address some important issues. As unused entries (all those 90 - except 12 and 34) are zero-filled, gpiomux needs a way to distinguish 91 - the used fields from the unused. In addition, the all-zero pattern 92 - is a valid configuration! Therefore, gpiomux defines an additional bit 93 - which is used to indicate when a field is used. This has the pleasant 94 - side-effect of allowing calls to msm_gpiomux_write to use '0' to indicate 95 - that a value should not be changed: 96 - 97 - msm_gpiomux_write(0, GPIOMUX_VALID, 0); 98 - 99 - replaces the active configuration of gpio 0 with an all-zero configuration, 100 - but leaves the suspended configuration as it was. 101 - 102 - Static Configurations 103 - ===================== 104 - 105 - To install a static configuration, which is applied at boot and does 106 - not change after that, install a configuration with a suspended component 107 - but no active component, as in the previous example: 108 - 109 - [34] = { 110 - .suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN, 111 - }, 112 - 113 - The suspended setting is applied during boot, and the lack of any valid 114 - active setting prevents any other setting from being applied at runtime. 115 - If other subsystems attempting to access the line is a concern, one could 116 - *really* anchor the configuration down by calling msm_gpiomux_get on the 117 - line at initialization to move the line into active mode. With the line 118 - held, it will never be re-suspended, and with no valid active configuration, 119 - no new configurations will be applied. 120 - 121 - But then, if having other subsystems grabbing for the line is truly a concern, 122 - it should be reserved with gpio_request instead, which carries an implicit 123 - msm_gpiomux_get. 124 - 125 - gpiomux and gpiolib 126 - =================== 127 - 128 - It is expected that msm gpio_chips will call msm_gpiomux_get() and 129 - msm_gpiomux_put() from their request and free hooks, like this fictional 130 - example: 131 - 132 - static int request(struct gpio_chip *chip, unsigned offset) 133 - { 134 - return msm_gpiomux_get(chip->base + offset); 135 - } 136 - 137 - static void free(struct gpio_chip *chip, unsigned offset) 138 - { 139 - msm_gpiomux_put(chip->base + offset); 140 - } 141 - 142 - ...somewhere in a gpio_chip declaration... 143 - .request = request, 144 - .free = free, 145 - 146 - This provides important functionality: 147 - - It guarantees that a gpio line will have its 'active' config applied 148 - when the line is requested, and will not be suspended while the line 149 - remains requested; and 150 - - It guarantees that gpio-direction settings from gpiolib behave sensibly. 151 - See "About Output-Enable Settings." 152 - 153 - This mechanism allows for "auto-request" of gpiomux lines via gpiolib 154 - when it is suitable. Drivers wishing more exact control are, of course, 155 - free to also use msm_gpiomux_set and msm_gpiomux_get. 156 - 157 - About Output-Enable Settings 158 - ============================ 159 - 160 - Some msm targets do not have the ability to query the current gpio 161 - configuration setting. This means that changes made to the output-enable 162 - (OE) bit by gpiolib cannot be consistently detected and preserved by gpiomux. 163 - Therefore, when gpiomux applies a configuration setting, any direction 164 - settings which may have been applied by gpiolib are lost and the default 165 - input settings are re-applied. 166 - 167 - For this reason, drivers should not assume that gpio direction settings 168 - continue to hold if they free and then re-request a gpio. This seems like 169 - common sense - after all, anybody could have obtained the line in the 170 - meantime - but it needs saying. 171 - 172 - This also means that calls to msm_gpiomux_write will reset the OE bit, 173 - which means that if the gpio line is held by a client of gpiolib and 174 - msm_gpiomux_write is called, the direction setting has been lost and 175 - gpiolib's internal state has been broken. 176 - Release gpio lines before reconfiguring them.
+2 -1
Documentation/devicetree/bindings/serial/atmel-usart.txt
··· 1 1 * Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART) 2 2 3 3 Required properties: 4 - - compatible: Should be "atmel,<chip>-usart" 4 + - compatible: Should be "atmel,<chip>-usart" or "atmel,<chip>-dbgu" 5 5 The compatible <chip> indicated will be the first SoC to support an 6 6 additional mode or an USART new feature. 7 + For the dbgu UART, use "atmel,<chip>-dbgu", "atmel,<chip>-usart" 7 8 - reg: Should contain registers location and length 8 9 - interrupts: Should contain interrupt 9 10 - clock-names: tuple listing input clock names.
+4 -16
MAINTAINERS
··· 1261 1261 W: http://wiki.openmoko.org/wiki/Neo_FreeRunner 1262 1262 S: Supported 1263 1263 1264 - ARM/QUALCOMM MSM MACHINE SUPPORT 1265 - M: David Brown <davidb@codeaurora.org> 1266 - M: Daniel Walker <dwalker@fifo99.com> 1267 - M: Bryan Huntsman <bryanh@codeaurora.org> 1268 - L: linux-arm-msm@vger.kernel.org 1269 - F: arch/arm/mach-msm/ 1270 - F: drivers/video/fbdev/msm/ 1271 - F: drivers/mmc/host/msm_sdcc.c 1272 - F: drivers/mmc/host/msm_sdcc.h 1273 - F: drivers/tty/serial/msm_serial.h 1274 - F: drivers/tty/serial/msm_serial.c 1275 - F: drivers/*/pm8???-* 1276 - F: drivers/mfd/ssbi.c 1277 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/davidb/linux-msm.git 1278 - S: Maintained 1279 - 1280 1264 ARM/TOSA MACHINE SUPPORT 1281 1265 M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 1282 1266 M: Dirk Opfer <dirk@opfer-online.de> ··· 1318 1334 S: Maintained 1319 1335 F: arch/arm/mach-qcom/ 1320 1336 F: drivers/soc/qcom/ 1337 + F: drivers/tty/serial/msm_serial.h 1338 + F: drivers/tty/serial/msm_serial.c 1339 + F: drivers/*/pm8???-* 1340 + F: drivers/mfd/ssbi.c 1321 1341 T: git git://git.kernel.org/pub/scm/linux/kernel/git/galak/linux-qcom.git 1322 1342 1323 1343 ARM/RADISYS ENP2611 MACHINE SUPPORT
+1 -15
arch/arm/Kconfig
··· 367 367 select ARCH_REQUIRE_GPIOLIB 368 368 select CLKDEV_LOOKUP 369 369 select IRQ_DOMAIN 370 - select NEED_MACH_IO_H if PCCARD 371 370 select PINCTRL 372 371 select PINCTRL_AT91 372 + select SOC_BUS 373 373 select USE_OF 374 374 help 375 375 This enables support for systems based on Atmel ··· 632 632 help 633 633 Support for Intel/Marvell's PXA2xx/PXA3xx processor line. 634 634 635 - config ARCH_MSM 636 - bool "Qualcomm MSM (non-multiplatform)" 637 - select ARCH_REQUIRE_GPIOLIB 638 - select COMMON_CLK 639 - select GENERIC_CLOCKEVENTS 640 - help 641 - Support for Qualcomm MSM/QSD based systems. This runs on the 642 - apps processor of the MSM/QSD and depends on a shared memory 643 - interface to the modem processor which runs the baseband 644 - stack and controls some vital subsystems 645 - (clock and power control, etc). 646 - 647 635 config ARCH_SHMOBILE_LEGACY 648 636 bool "Renesas ARM SoCs (non-multiplatform)" 649 637 select ARCH_SHMOBILE ··· 884 896 source "arch/arm/mach-ks8695/Kconfig" 885 897 886 898 source "arch/arm/mach-meson/Kconfig" 887 - 888 - source "arch/arm/mach-msm/Kconfig" 889 899 890 900 source "arch/arm/mach-moxart/Kconfig" 891 901
+5 -26
arch/arm/Kconfig.debug
··· 448 448 Say Y here if you want kernel low-level debugging support 449 449 on MMP UART3. 450 450 451 - config DEBUG_MSM_UART 452 - bool "Kernel low-level debugging messages via MSM UART" 453 - depends on ARCH_MSM 454 - help 455 - Say Y here if you want the debug print routines to direct 456 - their output to the serial port on MSM devices. 457 - 458 - ARCH DEBUG_UART_PHYS DEBUG_UART_VIRT # 459 - MSM7X00A, QSD8X50 0xa9a00000 0xe1000000 UART1 460 - MSM7X00A, QSD8X50 0xa9b00000 0xe1000000 UART2 461 - MSM7X00A, QSD8X50 0xa9c00000 0xe1000000 UART3 462 - 463 - MSM7X30 0xaca00000 0xe1000000 UART1 464 - MSM7X30 0xacb00000 0xe1000000 UART2 465 - MSM7X30 0xacc00000 0xe1000000 UART3 466 - 467 - Please adjust DEBUG_UART_PHYS and DEBUG_UART_BASE configuration 468 - options based on your needs. 469 - 470 451 config DEBUG_QCOM_UARTDM 471 452 bool "Kernel low-level debugging messages via QCOM UARTDM" 472 453 depends on ARCH_QCOM ··· 787 806 via SCIF2 on Renesas R-Car H1 (R8A7779). 788 807 789 808 config DEBUG_RCAR_GEN2_SCIF0 790 - bool "Kernel low-level debugging messages via SCIF0 on R8A7790/R8A7791/R8A7793)" 809 + bool "Kernel low-level debugging messages via SCIF0 on R8A7790/R8A7791/R8A7793" 791 810 depends on ARCH_R8A7790 || ARCH_R8A7791 || ARCH_R8A7793 792 811 help 793 812 Say Y here if you want kernel low-level debugging support ··· 1276 1295 DEBUG_IMX6SL_UART || \ 1277 1296 DEBUG_IMX6SX_UART 1278 1297 default "debug/ks8695.S" if DEBUG_KS8695_UART 1279 - default "debug/msm.S" if DEBUG_MSM_UART || DEBUG_QCOM_UARTDM 1298 + default "debug/msm.S" if DEBUG_QCOM_UARTDM 1280 1299 default "debug/netx.S" if DEBUG_NETX_UART 1281 1300 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 1282 1301 default "debug/renesas-scif.S" if DEBUG_R7S72100_SCIF2 ··· 1369 1388 default 0x80230000 if DEBUG_PICOXCELL_UART 1370 1389 default 0x808c0000 if ARCH_EP93XX 1371 1390 default 0x90020000 if DEBUG_NSPIRE_CLASSIC_UART || DEBUG_NSPIRE_CX_UART 1372 - default 0xa9a00000 if DEBUG_MSM_UART 1373 1391 default 0xb0060000 if DEBUG_SIRFPRIMA2_UART1 1374 1392 default 0xb0090000 if DEBUG_VEXPRESS_UART0_CRX 1375 1393 default 0xc0013000 if DEBUG_U300_UART ··· 1413 1433 DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1414 1434 DEBUG_LL_UART_EFM32 || \ 1415 1435 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ 1416 - DEBUG_MSM_UART || DEBUG_NETX_UART || \ 1436 + DEBUG_NETX_UART || \ 1417 1437 DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \ 1418 1438 DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \ 1419 1439 DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \ ··· 1426 1446 hex "Virtual base address of debug UART" 1427 1447 default 0xe0000a00 if DEBUG_NETX_UART 1428 1448 default 0xe0010fe0 if ARCH_RPC 1429 - default 0xe1000000 if DEBUG_MSM_UART 1430 1449 default 0xf0000be0 if ARCH_EBSA110 1431 1450 default 0xf0010000 if DEBUG_ASM9260_UART 1432 1451 default 0xf01fb000 if DEBUG_NOMADIK_UART ··· 1505 1526 default DEBUG_UART_PHYS if !MMU 1506 1527 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1507 1528 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ 1508 - DEBUG_MSM_UART || DEBUG_NETX_UART || \ 1529 + DEBUG_NETX_UART || \ 1509 1530 DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ 1510 1531 DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART || \ 1511 1532 DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0 ··· 1535 1556 1536 1557 config DEBUG_UNCOMPRESS 1537 1558 bool 1538 - depends on ARCH_MULTIPLATFORM || ARCH_MSM || PLAT_SAMSUNG 1559 + depends on ARCH_MULTIPLATFORM || PLAT_SAMSUNG 1539 1560 default y if DEBUG_LL && !DEBUG_OMAP2PLUS_UART && \ 1540 1561 (!DEBUG_TEGRA_UART || !ZBOOT_ROM) 1541 1562 help
-2
arch/arm/Makefile
··· 136 136 ifeq ($(CONFIG_ARCH_SA1100),y) 137 137 textofs-$(CONFIG_SA1111) := 0x00208000 138 138 endif 139 - textofs-$(CONFIG_ARCH_MSM7X30) := 0x00208000 140 139 textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000 141 140 textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000 142 141 textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000 ··· 170 171 machine-$(CONFIG_ARCH_MESON) += meson 171 172 machine-$(CONFIG_ARCH_MMP) += mmp 172 173 machine-$(CONFIG_ARCH_MOXART) += moxart 173 - machine-$(CONFIG_ARCH_MSM) += msm 174 174 machine-$(CONFIG_ARCH_MV78XX0) += mv78xx0 175 175 machine-$(CONFIG_ARCH_MVEBU) += mvebu 176 176 machine-$(CONFIG_ARCH_MXC) += imx
+1 -1
arch/arm/boot/dts/at91rm9200.dtsi
··· 830 830 }; 831 831 832 832 dbgu: serial@fffff200 { 833 - compatible = "atmel,at91rm9200-usart"; 833 + compatible = "atmel,at91rm9200-dbgu", "atmel,at91rm9200-usart"; 834 834 reg = <0xfffff200 0x200>; 835 835 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 836 836 pinctrl-names = "default";
+1 -1
arch/arm/boot/dts/at91sam9260.dtsi
··· 753 753 }; 754 754 755 755 dbgu: serial@fffff200 { 756 - compatible = "atmel,at91sam9260-usart"; 756 + compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; 757 757 reg = <0xfffff200 0x200>; 758 758 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 759 759 pinctrl-names = "default";
+1 -1
arch/arm/boot/dts/at91sam9261.dtsi
··· 276 276 }; 277 277 278 278 dbgu: serial@fffff200 { 279 - compatible = "atmel,at91sam9260-usart"; 279 + compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; 280 280 reg = <0xfffff200 0x200>; 281 281 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 282 282 pinctrl-names = "default";
+1 -1
arch/arm/boot/dts/at91sam9263.dtsi
··· 762 762 }; 763 763 764 764 dbgu: serial@ffffee00 { 765 - compatible = "atmel,at91sam9260-usart"; 765 + compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; 766 766 reg = <0xffffee00 0x200>; 767 767 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 768 768 pinctrl-names = "default";
+1 -1
arch/arm/boot/dts/at91sam9g45.dtsi
··· 893 893 }; 894 894 895 895 dbgu: serial@ffffee00 { 896 - compatible = "atmel,at91sam9260-usart"; 896 + compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; 897 897 reg = <0xffffee00 0x200>; 898 898 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 899 899 pinctrl-names = "default";
+1 -1
arch/arm/boot/dts/at91sam9n12.dtsi
··· 757 757 }; 758 758 759 759 dbgu: serial@fffff200 { 760 - compatible = "atmel,at91sam9260-usart"; 760 + compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; 761 761 reg = <0xfffff200 0x200>; 762 762 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 763 763 pinctrl-names = "default";
+1 -1
arch/arm/boot/dts/at91sam9rl.dtsi
··· 377 377 }; 378 378 379 379 dbgu: serial@fffff200 { 380 - compatible = "atmel,at91sam9260-usart"; 380 + compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; 381 381 reg = <0xfffff200 0x200>; 382 382 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 383 383 pinctrl-names = "default";
+1 -1
arch/arm/boot/dts/at91sam9x5.dtsi
··· 860 860 }; 861 861 862 862 dbgu: serial@fffff200 { 863 - compatible = "atmel,at91sam9260-usart"; 863 + compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; 864 864 reg = <0xfffff200 0x200>; 865 865 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 866 866 pinctrl-names = "default";
+1 -1
arch/arm/boot/dts/sama5d3.dtsi
··· 439 439 }; 440 440 441 441 dbgu: serial@ffffee00 { 442 - compatible = "atmel,at91sam9260-usart"; 442 + compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; 443 443 reg = <0xffffee00 0x200>; 444 444 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>; 445 445 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(13)>,
+1 -1
arch/arm/boot/dts/sama5d4.dtsi
··· 1064 1064 }; 1065 1065 1066 1066 dbgu: serial@fc069000 { 1067 - compatible = "atmel,at91sam9260-usart"; 1067 + compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart"; 1068 1068 reg = <0xfc069000 0x200>; 1069 1069 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>; 1070 1070 pinctrl-names = "default";
+1 -2
arch/arm/configs/imx_v4_v5_defconfig
··· 24 24 CONFIG_MACH_SCB9328=y 25 25 CONFIG_MACH_APF9328=y 26 26 CONFIG_MACH_MX21ADS=y 27 - CONFIG_MACH_MX25_3DS=y 28 27 CONFIG_MACH_EUKREA_CPUIMX25SD=y 29 - CONFIG_MACH_IMX25_DT=y 28 + CONFIG_SOC_IMX25=y 30 29 CONFIG_MACH_MX27ADS=y 31 30 CONFIG_MACH_MX27_3DS=y 32 31 CONFIG_MACH_IMX27_VISSTRIM_M10=y
-121
arch/arm/configs/msm_defconfig
··· 1 - CONFIG_SYSVIPC=y 2 - CONFIG_NO_HZ=y 3 - CONFIG_HIGH_RES_TIMERS=y 4 - CONFIG_IKCONFIG=y 5 - CONFIG_IKCONFIG_PROC=y 6 - CONFIG_BLK_DEV_INITRD=y 7 - CONFIG_SYSCTL_SYSCALL=y 8 - CONFIG_KALLSYMS_ALL=y 9 - CONFIG_EMBEDDED=y 10 - # CONFIG_SLUB_DEBUG is not set 11 - # CONFIG_COMPAT_BRK is not set 12 - CONFIG_PROFILING=y 13 - CONFIG_OPROFILE=y 14 - CONFIG_KPROBES=y 15 - CONFIG_MODULES=y 16 - CONFIG_MODULE_UNLOAD=y 17 - CONFIG_MODULE_FORCE_UNLOAD=y 18 - CONFIG_MODVERSIONS=y 19 - CONFIG_PARTITION_ADVANCED=y 20 - CONFIG_ARCH_MSM=y 21 - CONFIG_PREEMPT=y 22 - CONFIG_AEABI=y 23 - CONFIG_HIGHMEM=y 24 - CONFIG_HIGHPTE=y 25 - CONFIG_CLEANCACHE=y 26 - CONFIG_AUTO_ZRELADDR=y 27 - CONFIG_VFP=y 28 - # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 29 - CONFIG_NET=y 30 - CONFIG_PACKET=y 31 - CONFIG_UNIX=y 32 - CONFIG_INET=y 33 - CONFIG_IP_ADVANCED_ROUTER=y 34 - CONFIG_IP_MULTIPLE_TABLES=y 35 - CONFIG_IP_ROUTE_VERBOSE=y 36 - CONFIG_IP_PNP=y 37 - CONFIG_IP_PNP_DHCP=y 38 - # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 39 - # CONFIG_INET_XFRM_MODE_TUNNEL is not set 40 - # CONFIG_INET_XFRM_MODE_BEET is not set 41 - # CONFIG_INET_LRO is not set 42 - # CONFIG_IPV6 is not set 43 - CONFIG_CFG80211=y 44 - CONFIG_RFKILL=y 45 - CONFIG_BLK_DEV_LOOP=y 46 - CONFIG_BLK_DEV_RAM=y 47 - CONFIG_SCSI=y 48 - CONFIG_BLK_DEV_SD=y 49 - CONFIG_CHR_DEV_SG=y 50 - CONFIG_CHR_DEV_SCH=y 51 - CONFIG_SCSI_MULTI_LUN=y 52 - CONFIG_SCSI_CONSTANTS=y 53 - CONFIG_SCSI_LOGGING=y 54 - CONFIG_SCSI_SCAN_ASYNC=y 55 - CONFIG_NETDEVICES=y 56 - CONFIG_DUMMY=y 57 - CONFIG_SLIP=y 58 - CONFIG_SLIP_COMPRESSED=y 59 - CONFIG_SLIP_MODE_SLIP6=y 60 - CONFIG_USB_USBNET=y 61 - # CONFIG_USB_NET_AX8817X is not set 62 - # CONFIG_USB_NET_ZAURUS is not set 63 - CONFIG_INPUT_EVDEV=y 64 - # CONFIG_KEYBOARD_ATKBD is not set 65 - # CONFIG_MOUSE_PS2 is not set 66 - CONFIG_INPUT_JOYSTICK=y 67 - CONFIG_INPUT_TOUCHSCREEN=y 68 - CONFIG_INPUT_MISC=y 69 - CONFIG_INPUT_UINPUT=y 70 - CONFIG_SERIO_LIBPS2=y 71 - # CONFIG_LEGACY_PTYS is not set 72 - CONFIG_SERIAL_MSM=y 73 - CONFIG_SERIAL_MSM_CONSOLE=y 74 - # CONFIG_HW_RANDOM is not set 75 - CONFIG_I2C=y 76 - CONFIG_I2C_CHARDEV=y 77 - CONFIG_SPI=y 78 - CONFIG_DEBUG_GPIO=y 79 - CONFIG_GPIO_SYSFS=y 80 - CONFIG_THERMAL=y 81 - CONFIG_REGULATOR=y 82 - CONFIG_MEDIA_SUPPORT=y 83 - CONFIG_FB=y 84 - CONFIG_SOUND=y 85 - CONFIG_SND=y 86 - CONFIG_SND_DYNAMIC_MINORS=y 87 - # CONFIG_SND_ARM is not set 88 - # CONFIG_SND_SPI is not set 89 - # CONFIG_SND_USB is not set 90 - CONFIG_SND_SOC=y 91 - CONFIG_USB=y 92 - CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 93 - CONFIG_USB_MON=y 94 - CONFIG_USB_EHCI_HCD=y 95 - CONFIG_USB_ACM=y 96 - CONFIG_USB_SERIAL=y 97 - CONFIG_USB_GADGET=y 98 - CONFIG_USB_GADGET_DEBUG_FILES=y 99 - CONFIG_USB_GADGET_VBUS_DRAW=500 100 - CONFIG_RTC_CLASS=y 101 - CONFIG_STAGING=y 102 - CONFIG_EXT2_FS=y 103 - CONFIG_EXT2_FS_XATTR=y 104 - CONFIG_EXT3_FS=y 105 - # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 106 - CONFIG_EXT4_FS=y 107 - CONFIG_FUSE_FS=y 108 - CONFIG_VFAT_FS=y 109 - CONFIG_TMPFS=y 110 - CONFIG_NFS_FS=y 111 - CONFIG_NFS_V3_ACL=y 112 - CONFIG_NFS_V4=y 113 - CONFIG_CIFS=y 114 - CONFIG_PRINTK_TIME=y 115 - CONFIG_DYNAMIC_DEBUG=y 116 - CONFIG_DEBUG_INFO=y 117 - CONFIG_MAGIC_SYSRQ=y 118 - CONFIG_LOCKUP_DETECTOR=y 119 - # CONFIG_DETECT_HUNG_TASK is not set 120 - # CONFIG_SCHED_DEBUG is not set 121 - CONFIG_TIMER_STATS=y
+1 -1
arch/arm/configs/multi_v5_defconfig
··· 13 13 CONFIG_MACH_KIRKWOOD=y 14 14 CONFIG_MACH_NETXBIG=y 15 15 CONFIG_ARCH_MXC=y 16 - CONFIG_MACH_IMX25_DT=y 16 + CONFIG_SOC_IMX25=y 17 17 CONFIG_MACH_IMX27_DT=y 18 18 CONFIG_ARCH_U300=y 19 19 CONFIG_PCI_MVEBU=y
-14
arch/arm/include/debug/msm.S
··· 16 16 */ 17 17 18 18 .macro addruart, rp, rv, tmp 19 - #ifdef CONFIG_DEBUG_UART_PHYS 20 19 ldr \rp, =CONFIG_DEBUG_UART_PHYS 21 20 ldr \rv, =CONFIG_DEBUG_UART_VIRT 22 - #endif 23 21 .endm 24 22 25 23 .macro senduart, rd, rx 26 24 ARM_BE8(rev \rd, \rd ) 27 - #ifdef CONFIG_DEBUG_QCOM_UARTDM 28 25 @ Write the 1 character to UARTDM_TF 29 26 str \rd, [\rx, #0x70] 30 - #else 31 - str \rd, [\rx, #0x0C] 32 - #endif 33 27 .endm 34 28 35 29 .macro waituart, rd, rx 36 - #ifdef CONFIG_DEBUG_QCOM_UARTDM 37 30 @ check for TX_EMT in UARTDM_SR 38 31 ldr \rd, [\rx, #0x08] 39 32 ARM_BE8(rev \rd, \rd ) ··· 48 55 str \rd, [\rx, #0x40] 49 56 @ UARTDM reg. Read to induce delay 50 57 ldr \rd, [\rx, #0x08] 51 - #else 52 - @ wait for TX_READY 53 - 1001: ldr \rd, [\rx, #0x08] 54 - ARM_BE8(rev \rd, \rd ) 55 - tst \rd, #0x04 56 - beq 1001b 57 - #endif 58 58 .endm 59 59 60 60 .macro busyuart, rd, rx
+4 -15
arch/arm/mach-at91/Kconfig
··· 24 24 select GENERIC_CLOCKEVENTS 25 25 select MEMORY 26 26 select ATMEL_SDRAMC 27 - select PHYLIB if NETDEVICES 27 + select SRAM if PM 28 28 29 29 menu "Atmel AT91 System-on-Chip" 30 30 ··· 81 81 select CPU_ARM920T 82 82 select GENERIC_CLOCKEVENTS 83 83 select HAVE_AT91_USB_CLK 84 + select MIGHT_HAVE_PCI 85 + select SRAM if PM 84 86 85 87 config SOC_AT91SAM9 86 88 bool "AT91SAM9" ··· 96 94 select HAVE_AT91_UTMI 97 95 select HAVE_FB_ATMEL 98 96 select MEMORY 97 + select SRAM if PM 99 98 help 100 99 Select this if you are using one of those Atmel SoC: 101 100 AT91SAM9260 ··· 118 115 endif # SOC_SAM_V4_V5 119 116 120 117 comment "AT91 Feature Selections" 121 - 122 - config AT91_SLOW_CLOCK 123 - bool "Suspend-to-RAM disables main oscillator" 124 - select SRAM 125 - depends on SUSPEND 126 - help 127 - Select this if you want Suspend-to-RAM to save the most power 128 - possible (without powering off the CPU) by disabling the PLLs 129 - and main oscillator so that only the 32 KiHz clock is available. 130 - 131 - When only that slow-clock is available, some peripherals lose 132 - functionality. Many can't issue wakeup events unless faster 133 - clocks are available. Some lose their operating state and 134 - need to be completely re-initialized. 135 118 136 119 config AT91_TIMER_HZ 137 120 int "Kernel HZ (jiffies per second)"
+2 -2
arch/arm/mach-at91/Makefile
··· 2 2 # Makefile for the linux kernel. 3 3 # 4 4 5 - obj-y := setup.o 5 + obj-y := soc.o 6 6 7 7 obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o 8 8 ··· 13 13 14 14 # Power Management 15 15 obj-$(CONFIG_PM) += pm.o 16 - obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o 16 + obj-$(CONFIG_PM) += pm_suspend.o 17 17 18 18 ifeq ($(CONFIG_PM_DEBUG),y) 19 19 CFLAGS_pm.o += -DDEBUG
+16 -15
arch/arm/mach-at91/at91rm9200.c
··· 8 8 * Licensed under GPLv2 or later. 9 9 */ 10 10 11 - #include <linux/types.h> 12 - #include <linux/init.h> 13 - #include <linux/module.h> 14 - #include <linux/gpio.h> 15 - #include <linux/of.h> 16 - #include <linux/of_irq.h> 17 - #include <linux/of_platform.h> 18 11 #include <linux/clk-provider.h> 12 + #include <linux/of.h> 13 + #include <linux/of_platform.h> 19 14 20 - #include <asm/setup.h> 21 - #include <asm/irq.h> 22 15 #include <asm/mach/arch.h> 23 - #include <asm/mach/map.h> 24 - #include <asm/mach/irq.h> 25 16 #include <asm/system_misc.h> 26 17 27 18 #include <mach/at91_st.h> 28 19 29 20 #include "generic.h" 21 + #include "soc.h" 22 + 23 + static const struct at91_soc rm9200_socs[] = { 24 + AT91_SOC(AT91RM9200_CIDR_MATCH, 0, "at91rm9200 BGA", "at91rm9200"), 25 + { /* sentinel */ }, 26 + }; 30 27 31 28 static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd) 32 29 { ··· 42 45 43 46 static void __init at91rm9200_dt_device_init(void) 44 47 { 45 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 48 + struct soc_device *soc; 49 + struct device *soc_dev = NULL; 50 + 51 + soc = at91_soc_init(rm9200_socs); 52 + if (soc != NULL) 53 + soc_dev = soc_device_to_device(soc); 54 + 55 + of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); 46 56 47 57 arm_pm_idle = at91rm9200_idle; 48 58 arm_pm_restart = at91rm9200_restart; 49 59 at91rm9200_pm_init(); 50 60 } 51 - 52 - 53 61 54 62 static const char *at91rm9200_dt_board_compat[] __initconst = { 55 63 "atmel,at91rm9200", ··· 63 61 64 62 DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200") 65 63 .init_time = at91rm9200_dt_timer_init, 66 - .map_io = at91_map_io, 67 64 .init_machine = at91rm9200_dt_device_init, 68 65 .dt_compat = at91rm9200_dt_board_compat, 69 66 MACHINE_END
+55 -23
arch/arm/mach-at91/at91sam9.c
··· 7 7 * Licensed under GPLv2 or later. 8 8 */ 9 9 10 - #include <linux/types.h> 11 - #include <linux/init.h> 12 - #include <linux/module.h> 13 - #include <linux/gpio.h> 14 10 #include <linux/of.h> 15 - #include <linux/of_irq.h> 16 11 #include <linux/of_platform.h> 17 - #include <linux/clk-provider.h> 18 12 19 - #include <asm/system_misc.h> 20 - #include <asm/setup.h> 21 - #include <asm/irq.h> 22 13 #include <asm/mach/arch.h> 23 - #include <asm/mach/map.h> 24 - #include <asm/mach/irq.h> 14 + #include <asm/system_misc.h> 25 15 26 16 #include "generic.h" 17 + #include "soc.h" 18 + 19 + static const struct at91_soc at91sam9_socs[] = { 20 + AT91_SOC(AT91SAM9260_CIDR_MATCH, 0, "at91sam9260", NULL), 21 + AT91_SOC(AT91SAM9261_CIDR_MATCH, 0, "at91sam9261", NULL), 22 + AT91_SOC(AT91SAM9263_CIDR_MATCH, 0, "at91sam9263", NULL), 23 + AT91_SOC(AT91SAM9G20_CIDR_MATCH, 0, "at91sam9g20", NULL), 24 + AT91_SOC(AT91SAM9RL64_CIDR_MATCH, 0, "at91sam9rl64", NULL), 25 + AT91_SOC(AT91SAM9G45_CIDR_MATCH, AT91SAM9M11_EXID_MATCH, 26 + "at91sam9m11", "at91sam9g45"), 27 + AT91_SOC(AT91SAM9G45_CIDR_MATCH, AT91SAM9M10_EXID_MATCH, 28 + "at91sam9m10", "at91sam9g45"), 29 + AT91_SOC(AT91SAM9G45_CIDR_MATCH, AT91SAM9G46_EXID_MATCH, 30 + "at91sam9g46", "at91sam9g45"), 31 + AT91_SOC(AT91SAM9G45_CIDR_MATCH, AT91SAM9G45_EXID_MATCH, 32 + "at91sam9g45", "at91sam9g45"), 33 + AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9G15_EXID_MATCH, 34 + "at91sam9g15", "at91sam9x5"), 35 + AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9G35_EXID_MATCH, 36 + "at91sam9g35", "at91sam9x5"), 37 + AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9X35_EXID_MATCH, 38 + "at91sam9x35", "at91sam9x5"), 39 + AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9G25_EXID_MATCH, 40 + "at91sam9g25", "at91sam9x5"), 41 + AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9X25_EXID_MATCH, 42 + "at91sam9x25", "at91sam9x5"), 43 + AT91_SOC(AT91SAM9N12_CIDR_MATCH, AT91SAM9CN12_EXID_MATCH, 44 + "at91sam9cn12", "at91sam9n12"), 45 + AT91_SOC(AT91SAM9N12_CIDR_MATCH, AT91SAM9N12_EXID_MATCH, 46 + "at91sam9n12", "at91sam9n12"), 47 + AT91_SOC(AT91SAM9N12_CIDR_MATCH, AT91SAM9CN11_EXID_MATCH, 48 + "at91sam9cn11", "at91sam9n12"), 49 + AT91_SOC(AT91SAM9XE128_CIDR_MATCH, 0, "at91sam9xe128", "at91sam9xe128"), 50 + AT91_SOC(AT91SAM9XE256_CIDR_MATCH, 0, "at91sam9xe256", "at91sam9xe256"), 51 + AT91_SOC(AT91SAM9XE512_CIDR_MATCH, 0, "at91sam9xe512", "at91sam9xe512"), 52 + { /* sentinel */ }, 53 + }; 54 + 55 + static void __init at91sam9_common_init(void) 56 + { 57 + struct soc_device *soc; 58 + struct device *soc_dev = NULL; 59 + 60 + soc = at91_soc_init(at91sam9_socs); 61 + if (soc != NULL) 62 + soc_dev = soc_device_to_device(soc); 63 + 64 + of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); 65 + 66 + arm_pm_idle = at91sam9_idle; 67 + } 27 68 28 69 static void __init at91sam9_dt_device_init(void) 29 70 { 30 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 31 - 32 - arm_pm_idle = at91sam9_idle; 71 + at91sam9_common_init(); 33 72 at91sam9260_pm_init(); 34 73 } 35 74 ··· 79 40 80 41 DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM9") 81 42 /* Maintainer: Atmel */ 82 - .map_io = at91_map_io, 83 43 .init_machine = at91sam9_dt_device_init, 84 44 .dt_compat = at91_dt_board_compat, 85 45 MACHINE_END 86 46 87 47 static void __init at91sam9g45_dt_device_init(void) 88 48 { 89 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 90 - 91 - arm_pm_idle = at91sam9_idle; 49 + at91sam9_common_init(); 92 50 at91sam9g45_pm_init(); 93 51 } 94 52 ··· 96 60 97 61 DT_MACHINE_START(at91sam9g45_dt, "Atmel AT91SAM9G45") 98 62 /* Maintainer: Atmel */ 99 - .map_io = at91_map_io, 100 63 .init_machine = at91sam9g45_dt_device_init, 101 64 .dt_compat = at91sam9g45_board_compat, 102 65 MACHINE_END 103 66 104 67 static void __init at91sam9x5_dt_device_init(void) 105 68 { 106 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 107 - 108 - arm_pm_idle = at91sam9_idle; 69 + at91sam9_common_init(); 109 70 at91sam9x5_pm_init(); 110 71 } 111 72 ··· 114 81 115 82 DT_MACHINE_START(at91sam9x5_dt, "Atmel AT91SAM9") 116 83 /* Maintainer: Atmel */ 117 - .map_io = at91_map_io, 118 84 .init_machine = at91sam9x5_dt_device_init, 119 85 .dt_compat = at91sam9x5_board_compat, 120 86 MACHINE_END
-4
arch/arm/mach-at91/generic.h
··· 25 25 extern void at91rm9200_idle(void); 26 26 extern void at91sam9_idle(void); 27 27 28 - /* Matrix */ 29 - extern void at91_ioremap_matrix(u32 base_addr); 30 - 31 - 32 28 #ifdef CONFIG_PM 33 29 extern void __init at91rm9200_pm_init(void); 34 30 extern void __init at91sam9260_pm_init(void);
-23
arch/arm/mach-at91/include/mach/at91_matrix.h
··· 1 - /* 2 - * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> 3 - * 4 - * Under GPLv2 5 - */ 6 - 7 - #ifndef __MACH_AT91_MATRIX_H__ 8 - #define __MACH_AT91_MATRIX_H__ 9 - 10 - #ifndef __ASSEMBLY__ 11 - extern void __iomem *at91_matrix_base; 12 - 13 - #define at91_matrix_read(field) \ 14 - __raw_readl(at91_matrix_base + field) 15 - 16 - #define at91_matrix_write(field, value) \ 17 - __raw_writel(value, at91_matrix_base + field) 18 - 19 - #else 20 - .extern at91_matrix_base 21 - #endif 22 - 23 - #endif /* __MACH_AT91_MATRIX_H__ */
-80
arch/arm/mach-at91/include/mach/at91sam9260_matrix.h
··· 1 - /* 2 - * arch/arm/mach-at91/include/mach/at91sam9260_matrix.h 3 - * 4 - * Copyright (C) 2007 Atmel Corporation. 5 - * 6 - * Memory Controllers (MATRIX, EBI) - System peripherals registers. 7 - * Based on AT91SAM9260 datasheet revision B. 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License as published by 11 - * the Free Software Foundation; either version 2 of the License, or 12 - * (at your option) any later version. 13 - */ 14 - 15 - #ifndef AT91SAM9260_MATRIX_H 16 - #define AT91SAM9260_MATRIX_H 17 - 18 - #define AT91_MATRIX_MCFG0 0x00 /* Master Configuration Register 0 */ 19 - #define AT91_MATRIX_MCFG1 0x04 /* Master Configuration Register 1 */ 20 - #define AT91_MATRIX_MCFG2 0x08 /* Master Configuration Register 2 */ 21 - #define AT91_MATRIX_MCFG3 0x0C /* Master Configuration Register 3 */ 22 - #define AT91_MATRIX_MCFG4 0x10 /* Master Configuration Register 4 */ 23 - #define AT91_MATRIX_MCFG5 0x14 /* Master Configuration Register 5 */ 24 - #define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ 25 - #define AT91_MATRIX_ULBT_INFINITE (0 << 0) 26 - #define AT91_MATRIX_ULBT_SINGLE (1 << 0) 27 - #define AT91_MATRIX_ULBT_FOUR (2 << 0) 28 - #define AT91_MATRIX_ULBT_EIGHT (3 << 0) 29 - #define AT91_MATRIX_ULBT_SIXTEEN (4 << 0) 30 - 31 - #define AT91_MATRIX_SCFG0 0x40 /* Slave Configuration Register 0 */ 32 - #define AT91_MATRIX_SCFG1 0x44 /* Slave Configuration Register 1 */ 33 - #define AT91_MATRIX_SCFG2 0x48 /* Slave Configuration Register 2 */ 34 - #define AT91_MATRIX_SCFG3 0x4C /* Slave Configuration Register 3 */ 35 - #define AT91_MATRIX_SCFG4 0x50 /* Slave Configuration Register 4 */ 36 - #define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 37 - #define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 38 - #define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 39 - #define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16) 40 - #define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16) 41 - #define AT91_MATRIX_FIXED_DEFMSTR (7 << 18) /* Fixed Index of Default Master */ 42 - #define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */ 43 - #define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24) 44 - #define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24) 45 - 46 - #define AT91_MATRIX_PRAS0 0x80 /* Priority Register A for Slave 0 */ 47 - #define AT91_MATRIX_PRAS1 0x88 /* Priority Register A for Slave 1 */ 48 - #define AT91_MATRIX_PRAS2 0x90 /* Priority Register A for Slave 2 */ 49 - #define AT91_MATRIX_PRAS3 0x98 /* Priority Register A for Slave 3 */ 50 - #define AT91_MATRIX_PRAS4 0xA0 /* Priority Register A for Slave 4 */ 51 - #define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */ 52 - #define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */ 53 - #define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */ 54 - #define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */ 55 - #define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */ 56 - #define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */ 57 - 58 - #define AT91_MATRIX_MRCR 0x100 /* Master Remap Control Register */ 59 - #define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 60 - #define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 61 - 62 - #define AT91_MATRIX_EBICSA 0x11C /* EBI Chip Select Assignment Register */ 63 - #define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 64 - #define AT91_MATRIX_CS1A_SMC (0 << 1) 65 - #define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 66 - #define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */ 67 - #define AT91_MATRIX_CS3A_SMC (0 << 3) 68 - #define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3) 69 - #define AT91_MATRIX_CS4A (1 << 4) /* Chip Select 4 Assignment */ 70 - #define AT91_MATRIX_CS4A_SMC (0 << 4) 71 - #define AT91_MATRIX_CS4A_SMC_CF1 (1 << 4) 72 - #define AT91_MATRIX_CS5A (1 << 5) /* Chip Select 5 Assignment */ 73 - #define AT91_MATRIX_CS5A_SMC (0 << 5) 74 - #define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5) 75 - #define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ 76 - #define AT91_MATRIX_VDDIOMSEL (1 << 16) /* Memory voltage selection */ 77 - #define AT91_MATRIX_VDDIOMSEL_1_8V (0 << 16) 78 - #define AT91_MATRIX_VDDIOMSEL_3_3V (1 << 16) 79 - 80 - #endif
-64
arch/arm/mach-at91/include/mach/at91sam9261_matrix.h
··· 1 - /* 2 - * arch/arm/mach-at91/include/mach/at91sam9261_matrix.h 3 - * 4 - * Copyright (C) 2007 Atmel Corporation. 5 - * 6 - * Memory Controllers (MATRIX, EBI) - System peripherals registers. 7 - * Based on AT91SAM9261 datasheet revision D. 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License as published by 11 - * the Free Software Foundation; either version 2 of the License, or 12 - * (at your option) any later version. 13 - */ 14 - 15 - #ifndef AT91SAM9261_MATRIX_H 16 - #define AT91SAM9261_MATRIX_H 17 - 18 - #define AT91_MATRIX_MCFG 0x00 /* Master Configuration Register */ 19 - #define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 20 - #define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 21 - 22 - #define AT91_MATRIX_SCFG0 0x04 /* Slave Configuration Register 0 */ 23 - #define AT91_MATRIX_SCFG1 0x08 /* Slave Configuration Register 1 */ 24 - #define AT91_MATRIX_SCFG2 0x0C /* Slave Configuration Register 2 */ 25 - #define AT91_MATRIX_SCFG3 0x10 /* Slave Configuration Register 3 */ 26 - #define AT91_MATRIX_SCFG4 0x14 /* Slave Configuration Register 4 */ 27 - #define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 28 - #define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 29 - #define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 30 - #define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16) 31 - #define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16) 32 - #define AT91_MATRIX_FIXED_DEFMSTR (7 << 18) /* Fixed Index of Default Master */ 33 - 34 - #define AT91_MATRIX_TCR 0x24 /* TCM Configuration Register */ 35 - #define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */ 36 - #define AT91_MATRIX_ITCM_0 (0 << 0) 37 - #define AT91_MATRIX_ITCM_16 (5 << 0) 38 - #define AT91_MATRIX_ITCM_32 (6 << 0) 39 - #define AT91_MATRIX_ITCM_64 (7 << 0) 40 - #define AT91_MATRIX_DTCM_SIZE (0xf << 4) /* Size of DTCM enabled memory block */ 41 - #define AT91_MATRIX_DTCM_0 (0 << 4) 42 - #define AT91_MATRIX_DTCM_16 (5 << 4) 43 - #define AT91_MATRIX_DTCM_32 (6 << 4) 44 - #define AT91_MATRIX_DTCM_64 (7 << 4) 45 - 46 - #define AT91_MATRIX_EBICSA 0x30 /* EBI Chip Select Assignment Register */ 47 - #define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 48 - #define AT91_MATRIX_CS1A_SMC (0 << 1) 49 - #define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 50 - #define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */ 51 - #define AT91_MATRIX_CS3A_SMC (0 << 3) 52 - #define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3) 53 - #define AT91_MATRIX_CS4A (1 << 4) /* Chip Select 4 Assignment */ 54 - #define AT91_MATRIX_CS4A_SMC (0 << 4) 55 - #define AT91_MATRIX_CS4A_SMC_CF1 (1 << 4) 56 - #define AT91_MATRIX_CS5A (1 << 5) /* Chip Select 5 Assignment */ 57 - #define AT91_MATRIX_CS5A_SMC (0 << 5) 58 - #define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5) 59 - #define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ 60 - 61 - #define AT91_MATRIX_USBPUCR 0x34 /* USB Pad Pull-Up Control Register */ 62 - #define AT91_MATRIX_USBPUCR_PUON (1 << 30) /* USB Device PAD Pull-up Enable */ 63 - 64 - #endif
-129
arch/arm/mach-at91/include/mach/at91sam9263_matrix.h
··· 1 - /* 2 - * arch/arm/mach-at91/include/mach/at91sam9263_matrix.h 3 - * 4 - * Copyright (C) 2006 Atmel Corporation. 5 - * 6 - * Memory Controllers (MATRIX, EBI) - System peripherals registers. 7 - * Based on AT91SAM9263 datasheet revision B (Preliminary). 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License as published by 11 - * the Free Software Foundation; either version 2 of the License, or 12 - * (at your option) any later version. 13 - */ 14 - 15 - #ifndef AT91SAM9263_MATRIX_H 16 - #define AT91SAM9263_MATRIX_H 17 - 18 - #define AT91_MATRIX_MCFG0 0x00 /* Master Configuration Register 0 */ 19 - #define AT91_MATRIX_MCFG1 0x04 /* Master Configuration Register 1 */ 20 - #define AT91_MATRIX_MCFG2 0x08 /* Master Configuration Register 2 */ 21 - #define AT91_MATRIX_MCFG3 0x0C /* Master Configuration Register 3 */ 22 - #define AT91_MATRIX_MCFG4 0x10 /* Master Configuration Register 4 */ 23 - #define AT91_MATRIX_MCFG5 0x14 /* Master Configuration Register 5 */ 24 - #define AT91_MATRIX_MCFG6 0x18 /* Master Configuration Register 6 */ 25 - #define AT91_MATRIX_MCFG7 0x1C /* Master Configuration Register 7 */ 26 - #define AT91_MATRIX_MCFG8 0x20 /* Master Configuration Register 8 */ 27 - #define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ 28 - #define AT91_MATRIX_ULBT_INFINITE (0 << 0) 29 - #define AT91_MATRIX_ULBT_SINGLE (1 << 0) 30 - #define AT91_MATRIX_ULBT_FOUR (2 << 0) 31 - #define AT91_MATRIX_ULBT_EIGHT (3 << 0) 32 - #define AT91_MATRIX_ULBT_SIXTEEN (4 << 0) 33 - 34 - #define AT91_MATRIX_SCFG0 0x40 /* Slave Configuration Register 0 */ 35 - #define AT91_MATRIX_SCFG1 0x44 /* Slave Configuration Register 1 */ 36 - #define AT91_MATRIX_SCFG2 0x48 /* Slave Configuration Register 2 */ 37 - #define AT91_MATRIX_SCFG3 0x4C /* Slave Configuration Register 3 */ 38 - #define AT91_MATRIX_SCFG4 0x50 /* Slave Configuration Register 4 */ 39 - #define AT91_MATRIX_SCFG5 0x54 /* Slave Configuration Register 5 */ 40 - #define AT91_MATRIX_SCFG6 0x58 /* Slave Configuration Register 6 */ 41 - #define AT91_MATRIX_SCFG7 0x5C /* Slave Configuration Register 7 */ 42 - #define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 43 - #define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 44 - #define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 45 - #define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16) 46 - #define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16) 47 - #define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */ 48 - #define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */ 49 - #define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24) 50 - #define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24) 51 - 52 - #define AT91_MATRIX_PRAS0 0x80 /* Priority Register A for Slave 0 */ 53 - #define AT91_MATRIX_PRBS0 0x84 /* Priority Register B for Slave 0 */ 54 - #define AT91_MATRIX_PRAS1 0x88 /* Priority Register A for Slave 1 */ 55 - #define AT91_MATRIX_PRBS1 0x8C /* Priority Register B for Slave 1 */ 56 - #define AT91_MATRIX_PRAS2 0x90 /* Priority Register A for Slave 2 */ 57 - #define AT91_MATRIX_PRBS2 0x94 /* Priority Register B for Slave 2 */ 58 - #define AT91_MATRIX_PRAS3 0x98 /* Priority Register A for Slave 3 */ 59 - #define AT91_MATRIX_PRBS3 0x9C /* Priority Register B for Slave 3 */ 60 - #define AT91_MATRIX_PRAS4 0xA0 /* Priority Register A for Slave 4 */ 61 - #define AT91_MATRIX_PRBS4 0xA4 /* Priority Register B for Slave 4 */ 62 - #define AT91_MATRIX_PRAS5 0xA8 /* Priority Register A for Slave 5 */ 63 - #define AT91_MATRIX_PRBS5 0xAC /* Priority Register B for Slave 5 */ 64 - #define AT91_MATRIX_PRAS6 0xB0 /* Priority Register A for Slave 6 */ 65 - #define AT91_MATRIX_PRBS6 0xB4 /* Priority Register B for Slave 6 */ 66 - #define AT91_MATRIX_PRAS7 0xB8 /* Priority Register A for Slave 7 */ 67 - #define AT91_MATRIX_PRBS7 0xBC /* Priority Register B for Slave 7 */ 68 - #define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */ 69 - #define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */ 70 - #define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */ 71 - #define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */ 72 - #define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */ 73 - #define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */ 74 - #define AT91_MATRIX_M6PR (3 << 24) /* Master 6 Priority */ 75 - #define AT91_MATRIX_M7PR (3 << 28) /* Master 7 Priority */ 76 - #define AT91_MATRIX_M8PR (3 << 0) /* Master 8 Priority (in Register B) */ 77 - 78 - #define AT91_MATRIX_MRCR 0x100 /* Master Remap Control Register */ 79 - #define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 80 - #define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 81 - #define AT91_MATRIX_RCB2 (1 << 2) 82 - #define AT91_MATRIX_RCB3 (1 << 3) 83 - #define AT91_MATRIX_RCB4 (1 << 4) 84 - #define AT91_MATRIX_RCB5 (1 << 5) 85 - #define AT91_MATRIX_RCB6 (1 << 6) 86 - #define AT91_MATRIX_RCB7 (1 << 7) 87 - #define AT91_MATRIX_RCB8 (1 << 8) 88 - 89 - #define AT91_MATRIX_TCMR 0x114 /* TCM Configuration Register */ 90 - #define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */ 91 - #define AT91_MATRIX_ITCM_0 (0 << 0) 92 - #define AT91_MATRIX_ITCM_16 (5 << 0) 93 - #define AT91_MATRIX_ITCM_32 (6 << 0) 94 - #define AT91_MATRIX_DTCM_SIZE (0xf << 4) /* Size of DTCM enabled memory block */ 95 - #define AT91_MATRIX_DTCM_0 (0 << 4) 96 - #define AT91_MATRIX_DTCM_16 (5 << 4) 97 - #define AT91_MATRIX_DTCM_32 (6 << 4) 98 - 99 - #define AT91_MATRIX_EBI0CSA 0x120 /* EBI0 Chip Select Assignment Register */ 100 - #define AT91_MATRIX_EBI0_CS1A (1 << 1) /* Chip Select 1 Assignment */ 101 - #define AT91_MATRIX_EBI0_CS1A_SMC (0 << 1) 102 - #define AT91_MATRIX_EBI0_CS1A_SDRAMC (1 << 1) 103 - #define AT91_MATRIX_EBI0_CS3A (1 << 3) /* Chip Select 3 Assignment */ 104 - #define AT91_MATRIX_EBI0_CS3A_SMC (0 << 3) 105 - #define AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA (1 << 3) 106 - #define AT91_MATRIX_EBI0_CS4A (1 << 4) /* Chip Select 4 Assignment */ 107 - #define AT91_MATRIX_EBI0_CS4A_SMC (0 << 4) 108 - #define AT91_MATRIX_EBI0_CS4A_SMC_CF1 (1 << 4) 109 - #define AT91_MATRIX_EBI0_CS5A (1 << 5) /* Chip Select 5 Assignment */ 110 - #define AT91_MATRIX_EBI0_CS5A_SMC (0 << 5) 111 - #define AT91_MATRIX_EBI0_CS5A_SMC_CF2 (1 << 5) 112 - #define AT91_MATRIX_EBI0_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ 113 - #define AT91_MATRIX_EBI0_VDDIOMSEL (1 << 16) /* Memory voltage selection */ 114 - #define AT91_MATRIX_EBI0_VDDIOMSEL_1_8V (0 << 16) 115 - #define AT91_MATRIX_EBI0_VDDIOMSEL_3_3V (1 << 16) 116 - 117 - #define AT91_MATRIX_EBI1CSA 0x124 /* EBI1 Chip Select Assignment Register */ 118 - #define AT91_MATRIX_EBI1_CS1A (1 << 1) /* Chip Select 1 Assignment */ 119 - #define AT91_MATRIX_EBI1_CS1A_SMC (0 << 1) 120 - #define AT91_MATRIX_EBI1_CS1A_SDRAMC (1 << 1) 121 - #define AT91_MATRIX_EBI1_CS2A (1 << 3) /* Chip Select 3 Assignment */ 122 - #define AT91_MATRIX_EBI1_CS2A_SMC (0 << 3) 123 - #define AT91_MATRIX_EBI1_CS2A_SMC_SMARTMEDIA (1 << 3) 124 - #define AT91_MATRIX_EBI1_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ 125 - #define AT91_MATRIX_EBI1_VDDIOMSEL (1 << 16) /* Memory voltage selection */ 126 - #define AT91_MATRIX_EBI1_VDDIOMSEL_1_8V (0 << 16) 127 - #define AT91_MATRIX_EBI1_VDDIOMSEL_3_3V (1 << 16) 128 - 129 - #endif
-153
arch/arm/mach-at91/include/mach/at91sam9g45_matrix.h
··· 1 - /* 2 - * Matrix-centric header file for the AT91SAM9G45 family 3 - * 4 - * Copyright (C) 2008-2009 Atmel Corporation. 5 - * 6 - * Memory Controllers (MATRIX, EBI) - System peripherals registers. 7 - * Based on AT91SAM9G45 preliminary datasheet. 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License as published by 11 - * the Free Software Foundation; either version 2 of the License, or 12 - * (at your option) any later version. 13 - */ 14 - 15 - #ifndef AT91SAM9G45_MATRIX_H 16 - #define AT91SAM9G45_MATRIX_H 17 - 18 - #define AT91_MATRIX_MCFG0 0x00 /* Master Configuration Register 0 */ 19 - #define AT91_MATRIX_MCFG1 0x04 /* Master Configuration Register 1 */ 20 - #define AT91_MATRIX_MCFG2 0x08 /* Master Configuration Register 2 */ 21 - #define AT91_MATRIX_MCFG3 0x0C /* Master Configuration Register 3 */ 22 - #define AT91_MATRIX_MCFG4 0x10 /* Master Configuration Register 4 */ 23 - #define AT91_MATRIX_MCFG5 0x14 /* Master Configuration Register 5 */ 24 - #define AT91_MATRIX_MCFG6 0x18 /* Master Configuration Register 6 */ 25 - #define AT91_MATRIX_MCFG7 0x1C /* Master Configuration Register 7 */ 26 - #define AT91_MATRIX_MCFG8 0x20 /* Master Configuration Register 8 */ 27 - #define AT91_MATRIX_MCFG9 0x24 /* Master Configuration Register 9 */ 28 - #define AT91_MATRIX_MCFG10 0x28 /* Master Configuration Register 10 */ 29 - #define AT91_MATRIX_MCFG11 0x2C /* Master Configuration Register 11 */ 30 - #define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ 31 - #define AT91_MATRIX_ULBT_INFINITE (0 << 0) 32 - #define AT91_MATRIX_ULBT_SINGLE (1 << 0) 33 - #define AT91_MATRIX_ULBT_FOUR (2 << 0) 34 - #define AT91_MATRIX_ULBT_EIGHT (3 << 0) 35 - #define AT91_MATRIX_ULBT_SIXTEEN (4 << 0) 36 - #define AT91_MATRIX_ULBT_THIRTYTWO (5 << 0) 37 - #define AT91_MATRIX_ULBT_SIXTYFOUR (6 << 0) 38 - #define AT91_MATRIX_ULBT_128 (7 << 0) 39 - 40 - #define AT91_MATRIX_SCFG0 0x40 /* Slave Configuration Register 0 */ 41 - #define AT91_MATRIX_SCFG1 0x44 /* Slave Configuration Register 1 */ 42 - #define AT91_MATRIX_SCFG2 0x48 /* Slave Configuration Register 2 */ 43 - #define AT91_MATRIX_SCFG3 0x4C /* Slave Configuration Register 3 */ 44 - #define AT91_MATRIX_SCFG4 0x50 /* Slave Configuration Register 4 */ 45 - #define AT91_MATRIX_SCFG5 0x54 /* Slave Configuration Register 5 */ 46 - #define AT91_MATRIX_SCFG6 0x58 /* Slave Configuration Register 6 */ 47 - #define AT91_MATRIX_SCFG7 0x5C /* Slave Configuration Register 7 */ 48 - #define AT91_MATRIX_SLOT_CYCLE (0x1ff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 49 - #define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 50 - #define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 51 - #define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16) 52 - #define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16) 53 - #define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */ 54 - 55 - #define AT91_MATRIX_PRAS0 0x80 /* Priority Register A for Slave 0 */ 56 - #define AT91_MATRIX_PRBS0 0x84 /* Priority Register B for Slave 0 */ 57 - #define AT91_MATRIX_PRAS1 0x88 /* Priority Register A for Slave 1 */ 58 - #define AT91_MATRIX_PRBS1 0x8C /* Priority Register B for Slave 1 */ 59 - #define AT91_MATRIX_PRAS2 0x90 /* Priority Register A for Slave 2 */ 60 - #define AT91_MATRIX_PRBS2 0x94 /* Priority Register B for Slave 2 */ 61 - #define AT91_MATRIX_PRAS3 0x98 /* Priority Register A for Slave 3 */ 62 - #define AT91_MATRIX_PRBS3 0x9C /* Priority Register B for Slave 3 */ 63 - #define AT91_MATRIX_PRAS4 0xA0 /* Priority Register A for Slave 4 */ 64 - #define AT91_MATRIX_PRBS4 0xA4 /* Priority Register B for Slave 4 */ 65 - #define AT91_MATRIX_PRAS5 0xA8 /* Priority Register A for Slave 5 */ 66 - #define AT91_MATRIX_PRBS5 0xAC /* Priority Register B for Slave 5 */ 67 - #define AT91_MATRIX_PRAS6 0xB0 /* Priority Register A for Slave 6 */ 68 - #define AT91_MATRIX_PRBS6 0xB4 /* Priority Register B for Slave 6 */ 69 - #define AT91_MATRIX_PRAS7 0xB8 /* Priority Register A for Slave 7 */ 70 - #define AT91_MATRIX_PRBS7 0xBC /* Priority Register B for Slave 7 */ 71 - #define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */ 72 - #define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */ 73 - #define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */ 74 - #define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */ 75 - #define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */ 76 - #define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */ 77 - #define AT91_MATRIX_M6PR (3 << 24) /* Master 6 Priority */ 78 - #define AT91_MATRIX_M7PR (3 << 28) /* Master 7 Priority */ 79 - #define AT91_MATRIX_M8PR (3 << 0) /* Master 8 Priority (in Register B) */ 80 - #define AT91_MATRIX_M9PR (3 << 4) /* Master 9 Priority (in Register B) */ 81 - #define AT91_MATRIX_M10PR (3 << 8) /* Master 10 Priority (in Register B) */ 82 - #define AT91_MATRIX_M11PR (3 << 12) /* Master 11 Priority (in Register B) */ 83 - 84 - #define AT91_MATRIX_MRCR 0x100 /* Master Remap Control Register */ 85 - #define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 86 - #define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 87 - #define AT91_MATRIX_RCB2 (1 << 2) 88 - #define AT91_MATRIX_RCB3 (1 << 3) 89 - #define AT91_MATRIX_RCB4 (1 << 4) 90 - #define AT91_MATRIX_RCB5 (1 << 5) 91 - #define AT91_MATRIX_RCB6 (1 << 6) 92 - #define AT91_MATRIX_RCB7 (1 << 7) 93 - #define AT91_MATRIX_RCB8 (1 << 8) 94 - #define AT91_MATRIX_RCB9 (1 << 9) 95 - #define AT91_MATRIX_RCB10 (1 << 10) 96 - #define AT91_MATRIX_RCB11 (1 << 11) 97 - 98 - #define AT91_MATRIX_TCMR 0x110 /* TCM Configuration Register */ 99 - #define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */ 100 - #define AT91_MATRIX_ITCM_0 (0 << 0) 101 - #define AT91_MATRIX_ITCM_32 (6 << 0) 102 - #define AT91_MATRIX_DTCM_SIZE (0xf << 4) /* Size of DTCM enabled memory block */ 103 - #define AT91_MATRIX_DTCM_0 (0 << 4) 104 - #define AT91_MATRIX_DTCM_32 (6 << 4) 105 - #define AT91_MATRIX_DTCM_64 (7 << 4) 106 - #define AT91_MATRIX_TCM_NWS (0x1 << 11) /* Wait state TCM register */ 107 - #define AT91_MATRIX_TCM_NO_WS (0x0 << 11) 108 - #define AT91_MATRIX_TCM_ONE_WS (0x1 << 11) 109 - 110 - #define AT91_MATRIX_VIDEO 0x118 /* Video Mode Configuration Register */ 111 - #define AT91C_VDEC_SEL (0x1 << 0) /* Video Mode Selection */ 112 - #define AT91C_VDEC_SEL_OFF (0 << 0) 113 - #define AT91C_VDEC_SEL_ON (1 << 0) 114 - 115 - #define AT91_MATRIX_EBICSA 0x128 /* EBI Chip Select Assignment Register */ 116 - #define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */ 117 - #define AT91_MATRIX_EBI_CS1A_SMC (0 << 1) 118 - #define AT91_MATRIX_EBI_CS1A_SDRAMC (1 << 1) 119 - #define AT91_MATRIX_EBI_CS3A (1 << 3) /* Chip Select 3 Assignment */ 120 - #define AT91_MATRIX_EBI_CS3A_SMC (0 << 3) 121 - #define AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA (1 << 3) 122 - #define AT91_MATRIX_EBI_CS4A (1 << 4) /* Chip Select 4 Assignment */ 123 - #define AT91_MATRIX_EBI_CS4A_SMC (0 << 4) 124 - #define AT91_MATRIX_EBI_CS4A_SMC_CF0 (1 << 4) 125 - #define AT91_MATRIX_EBI_CS5A (1 << 5) /* Chip Select 5 Assignment */ 126 - #define AT91_MATRIX_EBI_CS5A_SMC (0 << 5) 127 - #define AT91_MATRIX_EBI_CS5A_SMC_CF1 (1 << 5) 128 - #define AT91_MATRIX_EBI_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ 129 - #define AT91_MATRIX_EBI_DBPU_ON (0 << 8) 130 - #define AT91_MATRIX_EBI_DBPU_OFF (1 << 8) 131 - #define AT91_MATRIX_EBI_VDDIOMSEL (1 << 16) /* Memory voltage selection */ 132 - #define AT91_MATRIX_EBI_VDDIOMSEL_1_8V (0 << 16) 133 - #define AT91_MATRIX_EBI_VDDIOMSEL_3_3V (1 << 16) 134 - #define AT91_MATRIX_EBI_EBI_IOSR (1 << 17) /* EBI I/O slew rate selection */ 135 - #define AT91_MATRIX_EBI_EBI_IOSR_REDUCED (0 << 17) 136 - #define AT91_MATRIX_EBI_EBI_IOSR_NORMAL (1 << 17) 137 - #define AT91_MATRIX_EBI_DDR_IOSR (1 << 18) /* DDR2 dedicated port I/O slew rate selection */ 138 - #define AT91_MATRIX_EBI_DDR_IOSR_REDUCED (0 << 18) 139 - #define AT91_MATRIX_EBI_DDR_IOSR_NORMAL (1 << 18) 140 - 141 - #define AT91_MATRIX_WPMR 0x1E4 /* Write Protect Mode Register */ 142 - #define AT91_MATRIX_WPMR_WPEN (1 << 0) /* Write Protect ENable */ 143 - #define AT91_MATRIX_WPMR_WP_WPDIS (0 << 0) 144 - #define AT91_MATRIX_WPMR_WP_WPEN (1 << 0) 145 - #define AT91_MATRIX_WPMR_WPKEY (0xFFFFFF << 8) /* Write Protect KEY */ 146 - 147 - #define AT91_MATRIX_WPSR 0x1E8 /* Write Protect Status Register */ 148 - #define AT91_MATRIX_WPSR_WPVS (1 << 0) /* Write Protect Violation Status */ 149 - #define AT91_MATRIX_WPSR_NO_WPV (0 << 0) 150 - #define AT91_MATRIX_WPSR_WPV (1 << 0) 151 - #define AT91_MATRIX_WPSR_WPVSRC (0xFFFF << 8) /* Write Protect Violation Source */ 152 - 153 - #endif
-53
arch/arm/mach-at91/include/mach/at91sam9n12_matrix.h
··· 1 - /* 2 - * Matrix-centric header file for the AT91SAM9N12 3 - * 4 - * Copyright (C) 2012 Atmel Corporation. 5 - * 6 - * Only EBI related registers. 7 - * Write Protect register definitions may be useful. 8 - * 9 - * Licensed under GPLv2 or later. 10 - */ 11 - 12 - #ifndef _AT91SAM9N12_MATRIX_H_ 13 - #define _AT91SAM9N12_MATRIX_H_ 14 - 15 - #define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x118) /* EBI Chip Select Assignment Register */ 16 - #define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */ 17 - #define AT91_MATRIX_EBI_CS1A_SMC (0 << 1) 18 - #define AT91_MATRIX_EBI_CS1A_SDRAMC (1 << 1) 19 - #define AT91_MATRIX_EBI_CS3A (1 << 3) /* Chip Select 3 Assignment */ 20 - #define AT91_MATRIX_EBI_CS3A_SMC (0 << 3) 21 - #define AT91_MATRIX_EBI_CS3A_SMC_NANDFLASH (1 << 3) 22 - #define AT91_MATRIX_EBI_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ 23 - #define AT91_MATRIX_EBI_DBPU_ON (0 << 8) 24 - #define AT91_MATRIX_EBI_DBPU_OFF (1 << 8) 25 - #define AT91_MATRIX_EBI_VDDIOMSEL (1 << 16) /* Memory voltage selection */ 26 - #define AT91_MATRIX_EBI_VDDIOMSEL_1_8V (0 << 16) 27 - #define AT91_MATRIX_EBI_VDDIOMSEL_3_3V (1 << 16) 28 - #define AT91_MATRIX_EBI_EBI_IOSR (1 << 17) /* EBI I/O slew rate selection */ 29 - #define AT91_MATRIX_EBI_EBI_IOSR_REDUCED (0 << 17) 30 - #define AT91_MATRIX_EBI_EBI_IOSR_NORMAL (1 << 17) 31 - #define AT91_MATRIX_EBI_DDR_IOSR (1 << 18) /* DDR2 dedicated port I/O slew rate selection */ 32 - #define AT91_MATRIX_EBI_DDR_IOSR_REDUCED (0 << 18) 33 - #define AT91_MATRIX_EBI_DDR_IOSR_NORMAL (1 << 18) 34 - #define AT91_MATRIX_NFD0_SELECT (1 << 24) /* NAND Flash Data Bus Selection */ 35 - #define AT91_MATRIX_NFD0_ON_D0 (0 << 24) 36 - #define AT91_MATRIX_NFD0_ON_D16 (1 << 24) 37 - #define AT91_MATRIX_DDR_MP_EN (1 << 25) /* DDR Multi-port Enable */ 38 - #define AT91_MATRIX_MP_OFF (0 << 25) 39 - #define AT91_MATRIX_MP_ON (1 << 25) 40 - 41 - #define AT91_MATRIX_WPMR (AT91_MATRIX + 0x1E4) /* Write Protect Mode Register */ 42 - #define AT91_MATRIX_WPMR_WPEN (1 << 0) /* Write Protect ENable */ 43 - #define AT91_MATRIX_WPMR_WP_WPDIS (0 << 0) 44 - #define AT91_MATRIX_WPMR_WP_WPEN (1 << 0) 45 - #define AT91_MATRIX_WPMR_WPKEY (0xFFFFFF << 8) /* Write Protect KEY */ 46 - 47 - #define AT91_MATRIX_WPSR (AT91_MATRIX + 0x1E8) /* Write Protect Status Register */ 48 - #define AT91_MATRIX_WPSR_WPVS (1 << 0) /* Write Protect Violation Status */ 49 - #define AT91_MATRIX_WPSR_NO_WPV (0 << 0) 50 - #define AT91_MATRIX_WPSR_WPV (1 << 0) 51 - #define AT91_MATRIX_WPSR_WPVSRC (0xFFFF << 8) /* Write Protect Violation Source */ 52 - 53 - #endif
-96
arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h
··· 1 - /* 2 - * arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h 3 - * 4 - * Copyright (C) 2007 Atmel Corporation 5 - * 6 - * Memory Controllers (MATRIX, EBI) - System peripherals registers. 7 - * Based on AT91SAM9RL datasheet revision A. (Preliminary) 8 - * 9 - * This file is subject to the terms and conditions of the GNU General Public 10 - * License. See the file COPYING in the main directory of this archive for 11 - * more details. 12 - */ 13 - 14 - #ifndef AT91SAM9RL_MATRIX_H 15 - #define AT91SAM9RL_MATRIX_H 16 - 17 - #define AT91_MATRIX_MCFG0 0x00 /* Master Configuration Register 0 */ 18 - #define AT91_MATRIX_MCFG1 0x04 /* Master Configuration Register 1 */ 19 - #define AT91_MATRIX_MCFG2 0x08 /* Master Configuration Register 2 */ 20 - #define AT91_MATRIX_MCFG3 0x0C /* Master Configuration Register 3 */ 21 - #define AT91_MATRIX_MCFG4 0x10 /* Master Configuration Register 4 */ 22 - #define AT91_MATRIX_MCFG5 0x14 /* Master Configuration Register 5 */ 23 - #define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ 24 - #define AT91_MATRIX_ULBT_INFINITE (0 << 0) 25 - #define AT91_MATRIX_ULBT_SINGLE (1 << 0) 26 - #define AT91_MATRIX_ULBT_FOUR (2 << 0) 27 - #define AT91_MATRIX_ULBT_EIGHT (3 << 0) 28 - #define AT91_MATRIX_ULBT_SIXTEEN (4 << 0) 29 - 30 - #define AT91_MATRIX_SCFG0 0x40 /* Slave Configuration Register 0 */ 31 - #define AT91_MATRIX_SCFG1 0x44 /* Slave Configuration Register 1 */ 32 - #define AT91_MATRIX_SCFG2 0x48 /* Slave Configuration Register 2 */ 33 - #define AT91_MATRIX_SCFG3 0x4C /* Slave Configuration Register 3 */ 34 - #define AT91_MATRIX_SCFG4 0x50 /* Slave Configuration Register 4 */ 35 - #define AT91_MATRIX_SCFG5 0x54 /* Slave Configuration Register 5 */ 36 - #define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */ 37 - #define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */ 38 - #define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16) 39 - #define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16) 40 - #define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16) 41 - #define AT91_MATRIX_FIXED_DEFMSTR (0xf << 18) /* Fixed Index of Default Master */ 42 - #define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */ 43 - #define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24) 44 - #define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24) 45 - 46 - #define AT91_MATRIX_PRAS0 0x80 /* Priority Register A for Slave 0 */ 47 - #define AT91_MATRIX_PRAS1 0x88 /* Priority Register A for Slave 1 */ 48 - #define AT91_MATRIX_PRAS2 0x90 /* Priority Register A for Slave 2 */ 49 - #define AT91_MATRIX_PRAS3 0x98 /* Priority Register A for Slave 3 */ 50 - #define AT91_MATRIX_PRAS4 0xA0 /* Priority Register A for Slave 4 */ 51 - #define AT91_MATRIX_PRAS5 0xA8 /* Priority Register A for Slave 5 */ 52 - #define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */ 53 - #define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */ 54 - #define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */ 55 - #define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */ 56 - #define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */ 57 - #define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */ 58 - 59 - #define AT91_MATRIX_MRCR 0x100 /* Master Remap Control Register */ 60 - #define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 61 - #define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 62 - #define AT91_MATRIX_RCB2 (1 << 2) 63 - #define AT91_MATRIX_RCB3 (1 << 3) 64 - #define AT91_MATRIX_RCB4 (1 << 4) 65 - #define AT91_MATRIX_RCB5 (1 << 5) 66 - 67 - #define AT91_MATRIX_TCMR 0x114 /* TCM Configuration Register */ 68 - #define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */ 69 - #define AT91_MATRIX_ITCM_0 (0 << 0) 70 - #define AT91_MATRIX_ITCM_16 (5 << 0) 71 - #define AT91_MATRIX_ITCM_32 (6 << 0) 72 - #define AT91_MATRIX_DTCM_SIZE (0xf << 4) /* Size of DTCM enabled memory block */ 73 - #define AT91_MATRIX_DTCM_0 (0 << 4) 74 - #define AT91_MATRIX_DTCM_16 (5 << 4) 75 - #define AT91_MATRIX_DTCM_32 (6 << 4) 76 - 77 - #define AT91_MATRIX_EBICSA 0x120 /* EBI0 Chip Select Assignment Register */ 78 - #define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 79 - #define AT91_MATRIX_CS1A_SMC (0 << 1) 80 - #define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 81 - #define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */ 82 - #define AT91_MATRIX_CS3A_SMC (0 << 3) 83 - #define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3) 84 - #define AT91_MATRIX_CS4A (1 << 4) /* Chip Select 4 Assignment */ 85 - #define AT91_MATRIX_CS4A_SMC (0 << 4) 86 - #define AT91_MATRIX_CS4A_SMC_CF1 (1 << 4) 87 - #define AT91_MATRIX_CS5A (1 << 5) /* Chip Select 5 Assignment */ 88 - #define AT91_MATRIX_CS5A_SMC (0 << 5) 89 - #define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5) 90 - #define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ 91 - #define AT91_MATRIX_VDDIOMSEL (1 << 16) /* Memory voltage selection */ 92 - #define AT91_MATRIX_VDDIOMSEL_1_8V (0 << 16) 93 - #define AT91_MATRIX_VDDIOMSEL_3_3V (1 << 16) 94 - 95 - 96 - #endif
-53
arch/arm/mach-at91/include/mach/at91sam9x5_matrix.h
··· 1 - /* 2 - * Matrix-centric header file for the AT91SAM9x5 family 3 - * 4 - * Copyright (C) 2009-2012 Atmel Corporation. 5 - * 6 - * Only EBI related registers. 7 - * Write Protect register definitions may be useful. 8 - * 9 - * Licensed under GPLv2 or later. 10 - */ 11 - 12 - #ifndef AT91SAM9X5_MATRIX_H 13 - #define AT91SAM9X5_MATRIX_H 14 - 15 - #define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI Chip Select Assignment Register */ 16 - #define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */ 17 - #define AT91_MATRIX_EBI_CS1A_SMC (0 << 1) 18 - #define AT91_MATRIX_EBI_CS1A_SDRAMC (1 << 1) 19 - #define AT91_MATRIX_EBI_CS3A (1 << 3) /* Chip Select 3 Assignment */ 20 - #define AT91_MATRIX_EBI_CS3A_SMC (0 << 3) 21 - #define AT91_MATRIX_EBI_CS3A_SMC_NANDFLASH (1 << 3) 22 - #define AT91_MATRIX_EBI_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */ 23 - #define AT91_MATRIX_EBI_DBPU_ON (0 << 8) 24 - #define AT91_MATRIX_EBI_DBPU_OFF (1 << 8) 25 - #define AT91_MATRIX_EBI_VDDIOMSEL (1 << 16) /* Memory voltage selection */ 26 - #define AT91_MATRIX_EBI_VDDIOMSEL_1_8V (0 << 16) 27 - #define AT91_MATRIX_EBI_VDDIOMSEL_3_3V (1 << 16) 28 - #define AT91_MATRIX_EBI_EBI_IOSR (1 << 17) /* EBI I/O slew rate selection */ 29 - #define AT91_MATRIX_EBI_EBI_IOSR_REDUCED (0 << 17) 30 - #define AT91_MATRIX_EBI_EBI_IOSR_NORMAL (1 << 17) 31 - #define AT91_MATRIX_EBI_DDR_IOSR (1 << 18) /* DDR2 dedicated port I/O slew rate selection */ 32 - #define AT91_MATRIX_EBI_DDR_IOSR_REDUCED (0 << 18) 33 - #define AT91_MATRIX_EBI_DDR_IOSR_NORMAL (1 << 18) 34 - #define AT91_MATRIX_NFD0_SELECT (1 << 24) /* NAND Flash Data Bus Selection */ 35 - #define AT91_MATRIX_NFD0_ON_D0 (0 << 24) 36 - #define AT91_MATRIX_NFD0_ON_D16 (1 << 24) 37 - #define AT91_MATRIX_DDR_MP_EN (1 << 25) /* DDR Multi-port Enable */ 38 - #define AT91_MATRIX_MP_OFF (0 << 25) 39 - #define AT91_MATRIX_MP_ON (1 << 25) 40 - 41 - #define AT91_MATRIX_WPMR (AT91_MATRIX + 0x1E4) /* Write Protect Mode Register */ 42 - #define AT91_MATRIX_WPMR_WPEN (1 << 0) /* Write Protect ENable */ 43 - #define AT91_MATRIX_WPMR_WP_WPDIS (0 << 0) 44 - #define AT91_MATRIX_WPMR_WP_WPEN (1 << 0) 45 - #define AT91_MATRIX_WPMR_WPKEY (0xFFFFFF << 8) /* Write Protect KEY */ 46 - 47 - #define AT91_MATRIX_WPSR (AT91_MATRIX + 0x1E8) /* Write Protect Status Register */ 48 - #define AT91_MATRIX_WPSR_WPVS (1 << 0) /* Write Protect Violation Status */ 49 - #define AT91_MATRIX_WPSR_NO_WPV (0 << 0) 50 - #define AT91_MATRIX_WPSR_WPV (1 << 0) 51 - #define AT91_MATRIX_WPSR_WPVSRC (0xFFFF << 8) /* Write Protect Violation Source */ 52 - 53 - #endif
-27
arch/arm/mach-at91/include/mach/io.h
··· 1 - /* 2 - * arch/arm/mach-at91/include/mach/io.h 3 - * 4 - * Copyright (C) 2003 SAN People 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 - */ 20 - 21 - #ifndef __ASM_ARCH_IO_H 22 - #define __ASM_ARCH_IO_H 23 - 24 - #define IO_SPACE_LIMIT 0xFFFFFFFF 25 - #define __io(a) __typesafe_io(a) 26 - 27 - #endif
+69 -74
arch/arm/mach-at91/pm.c
··· 29 29 #include <linux/atomic.h> 30 30 #include <asm/mach/time.h> 31 31 #include <asm/mach/irq.h> 32 + #include <asm/fncpy.h> 33 + #include <asm/cacheflush.h> 32 34 33 35 #include <mach/cpu.h> 34 36 #include <mach/hardware.h> ··· 43 41 int memctrl; 44 42 } at91_pm_data; 45 43 46 - static void (*at91_pm_standby)(void); 47 44 void __iomem *at91_ramc_base[2]; 48 45 49 46 static int at91_pm_valid_state(suspend_state_t state) ··· 120 119 } 121 120 EXPORT_SYMBOL(at91_suspend_entering_slow_clock); 122 121 123 - 124 - static void (*slow_clock)(void __iomem *pmc, void __iomem *ramc0, 122 + static void (*at91_suspend_sram_fn)(void __iomem *pmc, void __iomem *ramc0, 125 123 void __iomem *ramc1, int memctrl); 126 124 127 - #ifdef CONFIG_AT91_SLOW_CLOCK 128 - extern void at91_slow_clock(void __iomem *pmc, void __iomem *ramc0, 125 + extern void at91_pm_suspend_in_sram(void __iomem *pmc, void __iomem *ramc0, 129 126 void __iomem *ramc1, int memctrl); 130 - extern u32 at91_slow_clock_sz; 131 - #endif 127 + extern u32 at91_pm_suspend_in_sram_sz; 128 + 129 + static void at91_pm_suspend(suspend_state_t state) 130 + { 131 + unsigned int pm_data = at91_pm_data.memctrl; 132 + 133 + pm_data |= (state == PM_SUSPEND_MEM) ? 134 + AT91_PM_MODE(AT91_PM_SLOW_CLOCK) : 0; 135 + 136 + flush_cache_all(); 137 + outer_disable(); 138 + 139 + at91_suspend_sram_fn(at91_pmc_base, at91_ramc_base[0], 140 + at91_ramc_base[1], pm_data); 141 + 142 + outer_resume(); 143 + } 132 144 133 145 static int at91_pm_enter(suspend_state_t state) 134 146 { 135 147 at91_pinctrl_gpio_suspend(); 136 148 137 149 switch (state) { 150 + /* 151 + * Suspend-to-RAM is like STANDBY plus slow clock mode, so 152 + * drivers must suspend more deeply, the master clock switches 153 + * to the clk32k and turns off the main oscillator 154 + */ 155 + case PM_SUSPEND_MEM: 138 156 /* 139 - * Suspend-to-RAM is like STANDBY plus slow clock mode, so 140 - * drivers must suspend more deeply: only the master clock 141 - * controller may be using the main oscillator. 157 + * Ensure that clocks are in a valid state. 142 158 */ 143 - case PM_SUSPEND_MEM: 144 - /* 145 - * Ensure that clocks are in a valid state. 146 - */ 147 - if (!at91_pm_verify_clocks()) 148 - goto error; 149 - 150 - /* 151 - * Enter slow clock mode by switching over to clk32k and 152 - * turning off the main oscillator; reverse on wakeup. 153 - */ 154 - if (slow_clock) { 155 - #ifdef CONFIG_AT91_SLOW_CLOCK 156 - /* copy slow_clock handler to SRAM, and call it */ 157 - memcpy(slow_clock, at91_slow_clock, at91_slow_clock_sz); 158 - #endif 159 - slow_clock(at91_pmc_base, at91_ramc_base[0], 160 - at91_ramc_base[1], 161 - at91_pm_data.memctrl); 162 - break; 163 - } else { 164 - pr_info("AT91: PM - no slow clock mode enabled ...\n"); 165 - /* FALLTHROUGH leaving master clock alone */ 166 - } 167 - 168 - /* 169 - * STANDBY mode has *all* drivers suspended; ignores irqs not 170 - * marked as 'wakeup' event sources; and reduces DRAM power. 171 - * But otherwise it's identical to PM_SUSPEND_ON: cpu idle, and 172 - * nothing fancy done with main or cpu clocks. 173 - */ 174 - case PM_SUSPEND_STANDBY: 175 - /* 176 - * NOTE: the Wait-for-Interrupt instruction needs to be 177 - * in icache so no SDRAM accesses are needed until the 178 - * wakeup IRQ occurs and self-refresh is terminated. 179 - * For ARM 926 based chips, this requirement is weaker 180 - * as at91sam9 can access a RAM in self-refresh mode. 181 - */ 182 - if (at91_pm_standby) 183 - at91_pm_standby(); 184 - break; 185 - 186 - case PM_SUSPEND_ON: 187 - cpu_do_idle(); 188 - break; 189 - 190 - default: 191 - pr_debug("AT91: PM - bogus suspend state %d\n", state); 159 + if (!at91_pm_verify_clocks()) 192 160 goto error; 161 + 162 + at91_pm_suspend(state); 163 + 164 + break; 165 + 166 + /* 167 + * STANDBY mode has *all* drivers suspended; ignores irqs not 168 + * marked as 'wakeup' event sources; and reduces DRAM power. 169 + * But otherwise it's identical to PM_SUSPEND_ON: cpu idle, and 170 + * nothing fancy done with main or cpu clocks. 171 + */ 172 + case PM_SUSPEND_STANDBY: 173 + at91_pm_suspend(state); 174 + break; 175 + 176 + case PM_SUSPEND_ON: 177 + cpu_do_idle(); 178 + break; 179 + 180 + default: 181 + pr_debug("AT91: PM - bogus suspend state %d\n", state); 182 + goto error; 193 183 } 194 184 195 185 error: ··· 210 218 .name = "cpuidle-at91", 211 219 }; 212 220 213 - void at91_pm_set_standby(void (*at91_standby)(void)) 221 + static void at91_pm_set_standby(void (*at91_standby)(void)) 214 222 { 215 - if (at91_standby) { 223 + if (at91_standby) 216 224 at91_cpuidle_device.dev.platform_data = at91_standby; 217 - at91_pm_standby = at91_standby; 218 - } 219 225 } 220 226 221 227 static const struct of_device_id ramc_ids[] __initconst = { ··· 253 263 at91_pm_set_standby(standby); 254 264 } 255 265 256 - #ifdef CONFIG_AT91_SLOW_CLOCK 257 266 static void __init at91_pm_sram_init(void) 258 267 { 259 268 struct gen_pool *sram_pool; ··· 280 291 return; 281 292 } 282 293 283 - sram_base = gen_pool_alloc(sram_pool, at91_slow_clock_sz); 294 + sram_base = gen_pool_alloc(sram_pool, at91_pm_suspend_in_sram_sz); 284 295 if (!sram_base) { 285 - pr_warn("%s: unable to alloc ocram!\n", __func__); 296 + pr_warn("%s: unable to alloc sram!\n", __func__); 286 297 return; 287 298 } 288 299 289 300 sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base); 290 - slow_clock = __arm_ioremap_exec(sram_pbase, at91_slow_clock_sz, false); 291 - } 292 - #endif 301 + at91_suspend_sram_fn = __arm_ioremap_exec(sram_pbase, 302 + at91_pm_suspend_in_sram_sz, false); 303 + if (!at91_suspend_sram_fn) { 304 + pr_warn("SRAM: Could not map\n"); 305 + return; 306 + } 293 307 308 + /* Copy the pm suspend handler to SRAM */ 309 + at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn, 310 + &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); 311 + } 294 312 295 313 static void __init at91_pm_init(void) 296 314 { 297 - #ifdef CONFIG_AT91_SLOW_CLOCK 298 315 at91_pm_sram_init(); 299 - #endif 300 - 301 - pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : "")); 302 316 303 317 if (at91_cpuidle_device.dev.platform_data) 304 318 platform_device_register(&at91_cpuidle_device); 305 319 306 - suspend_set_ops(&at91_pm_ops); 320 + if (at91_suspend_sram_fn) 321 + suspend_set_ops(&at91_pm_ops); 322 + else 323 + pr_info("AT91: PM not supported, due to no SRAM allocated\n"); 307 324 } 308 325 309 326 void __init at91rm9200_pm_init(void)
+9 -5
arch/arm/mach-at91/pm.h
··· 15 15 16 16 #include <mach/at91_ramc.h> 17 17 18 - #ifdef CONFIG_PM 19 - extern void at91_pm_set_standby(void (*at91_standby)(void)); 20 - #else 21 - static inline void at91_pm_set_standby(void (*at91_standby)(void)) { } 22 - #endif 18 + #define AT91_PM_MEMTYPE_MASK 0x0f 19 + 20 + #define AT91_PM_MODE_OFFSET 4 21 + #define AT91_PM_MODE_MASK 0x01 22 + #define AT91_PM_MODE(x) (((x) & AT91_PM_MODE_MASK) << AT91_PM_MODE_OFFSET) 23 + 24 + #define AT91_PM_SLOW_CLOCK 0x01 23 25 24 26 /* 25 27 * The AT91RM9200 goes into self-refresh mode with this command, and will ··· 33 31 * still in self-refresh is "not recommended", but seems to work. 34 32 */ 35 33 34 + #ifndef __ASSEMBLY__ 36 35 static inline void at91rm9200_standby(void) 37 36 { 38 37 u32 lpr = at91_ramc_read(0, AT91RM9200_SDRAMC_LPR); ··· 114 111 at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1); 115 112 } 116 113 114 + #endif 117 115 #endif
-335
arch/arm/mach-at91/pm_slowclock.S
··· 1 - /* 2 - * arch/arm/mach-at91/pm_slow_clock.S 3 - * 4 - * Copyright (C) 2006 Savin Zlobec 5 - * 6 - * AT91SAM9 support: 7 - * Copyright (C) 2007 Anti Sullin <anti.sullin@artecdesign.ee 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License version 2 as 11 - * published by the Free Software Foundation. 12 - * 13 - */ 14 - 15 - #include <linux/linkage.h> 16 - #include <linux/clk/at91_pmc.h> 17 - #include <mach/hardware.h> 18 - #include <mach/at91_ramc.h> 19 - 20 - /* 21 - * When SLOWDOWN_MASTER_CLOCK is defined we will also slow down the Master 22 - * clock during suspend by adjusting its prescalar and divisor. 23 - * NOTE: This hasn't been shown to be stable on SAM9s; and on the RM9200 there 24 - * are errata regarding adjusting the prescalar and divisor. 25 - */ 26 - #undef SLOWDOWN_MASTER_CLOCK 27 - 28 - pmc .req r0 29 - sdramc .req r1 30 - ramc1 .req r2 31 - memctrl .req r3 32 - tmp1 .req r4 33 - tmp2 .req r5 34 - 35 - /* 36 - * Wait until master clock is ready (after switching master clock source) 37 - */ 38 - .macro wait_mckrdy 39 - 1: ldr tmp1, [pmc, #AT91_PMC_SR] 40 - tst tmp1, #AT91_PMC_MCKRDY 41 - beq 1b 42 - .endm 43 - 44 - /* 45 - * Wait until master oscillator has stabilized. 46 - */ 47 - .macro wait_moscrdy 48 - 1: ldr tmp1, [pmc, #AT91_PMC_SR] 49 - tst tmp1, #AT91_PMC_MOSCS 50 - beq 1b 51 - .endm 52 - 53 - /* 54 - * Wait until PLLA has locked. 55 - */ 56 - .macro wait_pllalock 57 - 1: ldr tmp1, [pmc, #AT91_PMC_SR] 58 - tst tmp1, #AT91_PMC_LOCKA 59 - beq 1b 60 - .endm 61 - 62 - /* 63 - * Wait until PLLB has locked. 64 - */ 65 - .macro wait_pllblock 66 - 1: ldr tmp1, [pmc, #AT91_PMC_SR] 67 - tst tmp1, #AT91_PMC_LOCKB 68 - beq 1b 69 - .endm 70 - 71 - .text 72 - 73 - .arm 74 - 75 - /* void at91_slow_clock(void __iomem *pmc, void __iomem *sdramc, 76 - * void __iomem *ramc1, int memctrl) 77 - */ 78 - ENTRY(at91_slow_clock) 79 - /* Save registers on stack */ 80 - stmfd sp!, {r4 - r12, lr} 81 - 82 - /* 83 - * Register usage: 84 - * R0 = Base address of AT91_PMC 85 - * R1 = Base address of RAM Controller (SDRAM, DDRSDR, or AT91_SYS) 86 - * R2 = Base address of second RAM Controller or 0 if not present 87 - * R3 = Memory controller 88 - * R4 = temporary register 89 - * R5 = temporary register 90 - */ 91 - 92 - /* Drain write buffer */ 93 - mov tmp1, #0 94 - mcr p15, 0, tmp1, c7, c10, 4 95 - 96 - cmp memctrl, #AT91_MEMCTRL_MC 97 - bne ddr_sr_enable 98 - 99 - /* 100 - * at91rm9200 Memory controller 101 - */ 102 - /* Put SDRAM in self-refresh mode */ 103 - mov tmp1, #1 104 - str tmp1, [sdramc, #AT91RM9200_SDRAMC_SRR] 105 - b sdr_sr_done 106 - 107 - /* 108 - * DDRSDR Memory controller 109 - */ 110 - ddr_sr_enable: 111 - cmp memctrl, #AT91_MEMCTRL_DDRSDR 112 - bne sdr_sr_enable 113 - 114 - /* LPDDR1 --> force DDR2 mode during self-refresh */ 115 - ldr tmp1, [sdramc, #AT91_DDRSDRC_MDR] 116 - str tmp1, .saved_sam9_mdr 117 - bic tmp1, tmp1, #~AT91_DDRSDRC_MD 118 - cmp tmp1, #AT91_DDRSDRC_MD_LOW_POWER_DDR 119 - ldreq tmp1, [sdramc, #AT91_DDRSDRC_MDR] 120 - biceq tmp1, tmp1, #AT91_DDRSDRC_MD 121 - orreq tmp1, tmp1, #AT91_DDRSDRC_MD_DDR2 122 - streq tmp1, [sdramc, #AT91_DDRSDRC_MDR] 123 - 124 - /* prepare for DDRAM self-refresh mode */ 125 - ldr tmp1, [sdramc, #AT91_DDRSDRC_LPR] 126 - str tmp1, .saved_sam9_lpr 127 - bic tmp1, #AT91_DDRSDRC_LPCB 128 - orr tmp1, #AT91_DDRSDRC_LPCB_SELF_REFRESH 129 - 130 - /* figure out if we use the second ram controller */ 131 - cmp ramc1, #0 132 - beq ddr_no_2nd_ctrl 133 - 134 - ldr tmp2, [ramc1, #AT91_DDRSDRC_MDR] 135 - str tmp2, .saved_sam9_mdr1 136 - bic tmp2, tmp2, #~AT91_DDRSDRC_MD 137 - cmp tmp2, #AT91_DDRSDRC_MD_LOW_POWER_DDR 138 - ldreq tmp2, [ramc1, #AT91_DDRSDRC_MDR] 139 - biceq tmp2, tmp2, #AT91_DDRSDRC_MD 140 - orreq tmp2, tmp2, #AT91_DDRSDRC_MD_DDR2 141 - streq tmp2, [ramc1, #AT91_DDRSDRC_MDR] 142 - 143 - ldr tmp2, [ramc1, #AT91_DDRSDRC_LPR] 144 - str tmp2, .saved_sam9_lpr1 145 - bic tmp2, #AT91_DDRSDRC_LPCB 146 - orr tmp2, #AT91_DDRSDRC_LPCB_SELF_REFRESH 147 - 148 - /* Enable DDRAM self-refresh mode */ 149 - str tmp2, [ramc1, #AT91_DDRSDRC_LPR] 150 - ddr_no_2nd_ctrl: 151 - str tmp1, [sdramc, #AT91_DDRSDRC_LPR] 152 - 153 - b sdr_sr_done 154 - 155 - /* 156 - * SDRAMC Memory controller 157 - */ 158 - sdr_sr_enable: 159 - /* Enable SDRAM self-refresh mode */ 160 - ldr tmp1, [sdramc, #AT91_SDRAMC_LPR] 161 - str tmp1, .saved_sam9_lpr 162 - 163 - bic tmp1, #AT91_SDRAMC_LPCB 164 - orr tmp1, #AT91_SDRAMC_LPCB_SELF_REFRESH 165 - str tmp1, [sdramc, #AT91_SDRAMC_LPR] 166 - 167 - sdr_sr_done: 168 - /* Save Master clock setting */ 169 - ldr tmp1, [pmc, #AT91_PMC_MCKR] 170 - str tmp1, .saved_mckr 171 - 172 - /* 173 - * Set the Master clock source to slow clock 174 - */ 175 - bic tmp1, tmp1, #AT91_PMC_CSS 176 - str tmp1, [pmc, #AT91_PMC_MCKR] 177 - 178 - wait_mckrdy 179 - 180 - #ifdef SLOWDOWN_MASTER_CLOCK 181 - /* 182 - * Set the Master Clock PRES and MDIV fields. 183 - * 184 - * See AT91RM9200 errata #27 and #28 for details. 185 - */ 186 - mov tmp1, #0 187 - str tmp1, [pmc, #AT91_PMC_MCKR] 188 - 189 - wait_mckrdy 190 - #endif 191 - 192 - /* Save PLLA setting and disable it */ 193 - ldr tmp1, [pmc, #AT91_CKGR_PLLAR] 194 - str tmp1, .saved_pllar 195 - 196 - mov tmp1, #AT91_PMC_PLLCOUNT 197 - orr tmp1, tmp1, #(1 << 29) /* bit 29 always set */ 198 - str tmp1, [pmc, #AT91_CKGR_PLLAR] 199 - 200 - /* Save PLLB setting and disable it */ 201 - ldr tmp1, [pmc, #AT91_CKGR_PLLBR] 202 - str tmp1, .saved_pllbr 203 - 204 - mov tmp1, #AT91_PMC_PLLCOUNT 205 - str tmp1, [pmc, #AT91_CKGR_PLLBR] 206 - 207 - /* Turn off the main oscillator */ 208 - ldr tmp1, [pmc, #AT91_CKGR_MOR] 209 - bic tmp1, tmp1, #AT91_PMC_MOSCEN 210 - orr tmp1, tmp1, #AT91_PMC_KEY 211 - str tmp1, [pmc, #AT91_CKGR_MOR] 212 - 213 - /* Wait for interrupt */ 214 - mcr p15, 0, tmp1, c7, c0, 4 215 - 216 - /* Turn on the main oscillator */ 217 - ldr tmp1, [pmc, #AT91_CKGR_MOR] 218 - orr tmp1, tmp1, #AT91_PMC_MOSCEN 219 - orr tmp1, tmp1, #AT91_PMC_KEY 220 - str tmp1, [pmc, #AT91_CKGR_MOR] 221 - 222 - wait_moscrdy 223 - 224 - /* Restore PLLB setting */ 225 - ldr tmp1, .saved_pllbr 226 - str tmp1, [pmc, #AT91_CKGR_PLLBR] 227 - 228 - tst tmp1, #(AT91_PMC_MUL & 0xff0000) 229 - bne 1f 230 - tst tmp1, #(AT91_PMC_MUL & ~0xff0000) 231 - beq 2f 232 - 1: 233 - wait_pllblock 234 - 2: 235 - 236 - /* Restore PLLA setting */ 237 - ldr tmp1, .saved_pllar 238 - str tmp1, [pmc, #AT91_CKGR_PLLAR] 239 - 240 - tst tmp1, #(AT91_PMC_MUL & 0xff0000) 241 - bne 3f 242 - tst tmp1, #(AT91_PMC_MUL & ~0xff0000) 243 - beq 4f 244 - 3: 245 - wait_pllalock 246 - 4: 247 - 248 - #ifdef SLOWDOWN_MASTER_CLOCK 249 - /* 250 - * First set PRES if it was not 0, 251 - * than set CSS and MDIV fields. 252 - * 253 - * See AT91RM9200 errata #27 and #28 for details. 254 - */ 255 - ldr tmp1, .saved_mckr 256 - tst tmp1, #AT91_PMC_PRES 257 - beq 2f 258 - and tmp1, tmp1, #AT91_PMC_PRES 259 - str tmp1, [pmc, #AT91_PMC_MCKR] 260 - 261 - wait_mckrdy 262 - #endif 263 - 264 - /* 265 - * Restore master clock setting 266 - */ 267 - 2: ldr tmp1, .saved_mckr 268 - str tmp1, [pmc, #AT91_PMC_MCKR] 269 - 270 - wait_mckrdy 271 - 272 - /* 273 - * at91rm9200 Memory controller 274 - * Do nothing - self-refresh is automatically disabled. 275 - */ 276 - cmp memctrl, #AT91_MEMCTRL_MC 277 - beq ram_restored 278 - 279 - /* 280 - * DDRSDR Memory controller 281 - */ 282 - cmp memctrl, #AT91_MEMCTRL_DDRSDR 283 - bne sdr_en_restore 284 - /* Restore MDR in case of LPDDR1 */ 285 - ldr tmp1, .saved_sam9_mdr 286 - str tmp1, [sdramc, #AT91_DDRSDRC_MDR] 287 - /* Restore LPR on AT91 with DDRAM */ 288 - ldr tmp1, .saved_sam9_lpr 289 - str tmp1, [sdramc, #AT91_DDRSDRC_LPR] 290 - 291 - /* if we use the second ram controller */ 292 - cmp ramc1, #0 293 - ldrne tmp2, .saved_sam9_mdr1 294 - strne tmp2, [ramc1, #AT91_DDRSDRC_MDR] 295 - ldrne tmp2, .saved_sam9_lpr1 296 - strne tmp2, [ramc1, #AT91_DDRSDRC_LPR] 297 - 298 - b ram_restored 299 - 300 - /* 301 - * SDRAMC Memory controller 302 - */ 303 - sdr_en_restore: 304 - /* Restore LPR on AT91 with SDRAM */ 305 - ldr tmp1, .saved_sam9_lpr 306 - str tmp1, [sdramc, #AT91_SDRAMC_LPR] 307 - 308 - ram_restored: 309 - /* Restore registers, and return */ 310 - ldmfd sp!, {r4 - r12, pc} 311 - 312 - 313 - .saved_mckr: 314 - .word 0 315 - 316 - .saved_pllar: 317 - .word 0 318 - 319 - .saved_pllbr: 320 - .word 0 321 - 322 - .saved_sam9_lpr: 323 - .word 0 324 - 325 - .saved_sam9_lpr1: 326 - .word 0 327 - 328 - .saved_sam9_mdr: 329 - .word 0 330 - 331 - .saved_sam9_mdr1: 332 - .word 0 333 - 334 - ENTRY(at91_slow_clock_sz) 335 - .word .-at91_slow_clock
+338
arch/arm/mach-at91/pm_suspend.S
··· 1 + /* 2 + * arch/arm/mach-at91/pm_slow_clock.S 3 + * 4 + * Copyright (C) 2006 Savin Zlobec 5 + * 6 + * AT91SAM9 support: 7 + * Copyright (C) 2007 Anti Sullin <anti.sullin@artecdesign.ee 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License version 2 as 11 + * published by the Free Software Foundation. 12 + * 13 + */ 14 + #include <linux/linkage.h> 15 + #include <linux/clk/at91_pmc.h> 16 + #include <mach/hardware.h> 17 + #include <mach/at91_ramc.h> 18 + #include "pm.h" 19 + 20 + #define SRAMC_SELF_FRESH_ACTIVE 0x01 21 + #define SRAMC_SELF_FRESH_EXIT 0x00 22 + 23 + pmc .req r0 24 + tmp1 .req r4 25 + tmp2 .req r5 26 + 27 + /* 28 + * Wait until master clock is ready (after switching master clock source) 29 + */ 30 + .macro wait_mckrdy 31 + 1: ldr tmp1, [pmc, #AT91_PMC_SR] 32 + tst tmp1, #AT91_PMC_MCKRDY 33 + beq 1b 34 + .endm 35 + 36 + /* 37 + * Wait until master oscillator has stabilized. 38 + */ 39 + .macro wait_moscrdy 40 + 1: ldr tmp1, [pmc, #AT91_PMC_SR] 41 + tst tmp1, #AT91_PMC_MOSCS 42 + beq 1b 43 + .endm 44 + 45 + /* 46 + * Wait until PLLA has locked. 47 + */ 48 + .macro wait_pllalock 49 + 1: ldr tmp1, [pmc, #AT91_PMC_SR] 50 + tst tmp1, #AT91_PMC_LOCKA 51 + beq 1b 52 + .endm 53 + 54 + /* 55 + * Put the processor to enter the idle state 56 + */ 57 + .macro at91_cpu_idle 58 + 59 + #if defined(CONFIG_CPU_V7) 60 + mov tmp1, #AT91_PMC_PCK 61 + str tmp1, [pmc, #AT91_PMC_SCDR] 62 + 63 + dsb 64 + 65 + wfi @ Wait For Interrupt 66 + #else 67 + mcr p15, 0, tmp1, c7, c0, 4 68 + #endif 69 + 70 + .endm 71 + 72 + .text 73 + 74 + .arm 75 + 76 + /* 77 + * void at91_pm_suspend_in_sram(void __iomem *pmc, void __iomem *sdramc, 78 + * void __iomem *ramc1, int memctrl) 79 + * @input param: 80 + * @r0: base address of AT91_PMC 81 + * @r1: base address of SDRAM Controller (SDRAM, DDRSDR, or AT91_SYS) 82 + * @r2: base address of second SDRAM Controller or 0 if not present 83 + * @r3: pm information 84 + */ 85 + ENTRY(at91_pm_suspend_in_sram) 86 + /* Save registers on stack */ 87 + stmfd sp!, {r4 - r12, lr} 88 + 89 + /* Drain write buffer */ 90 + mov tmp1, #0 91 + mcr p15, 0, tmp1, c7, c10, 4 92 + 93 + str r0, .pmc_base 94 + str r1, .sramc_base 95 + str r2, .sramc1_base 96 + 97 + and r0, r3, #AT91_PM_MEMTYPE_MASK 98 + str r0, .memtype 99 + 100 + lsr r0, r3, #AT91_PM_MODE_OFFSET 101 + and r0, r0, #AT91_PM_MODE_MASK 102 + str r0, .pm_mode 103 + 104 + /* Active the self-refresh mode */ 105 + mov r0, #SRAMC_SELF_FRESH_ACTIVE 106 + bl at91_sramc_self_refresh 107 + 108 + ldr r0, .pm_mode 109 + tst r0, #AT91_PM_SLOW_CLOCK 110 + beq skip_disable_main_clock 111 + 112 + ldr pmc, .pmc_base 113 + 114 + /* Save Master clock setting */ 115 + ldr tmp1, [pmc, #AT91_PMC_MCKR] 116 + str tmp1, .saved_mckr 117 + 118 + /* 119 + * Set the Master clock source to slow clock 120 + */ 121 + bic tmp1, tmp1, #AT91_PMC_CSS 122 + str tmp1, [pmc, #AT91_PMC_MCKR] 123 + 124 + wait_mckrdy 125 + 126 + /* Save PLLA setting and disable it */ 127 + ldr tmp1, [pmc, #AT91_CKGR_PLLAR] 128 + str tmp1, .saved_pllar 129 + 130 + mov tmp1, #AT91_PMC_PLLCOUNT 131 + orr tmp1, tmp1, #(1 << 29) /* bit 29 always set */ 132 + str tmp1, [pmc, #AT91_CKGR_PLLAR] 133 + 134 + /* Turn off the main oscillator */ 135 + ldr tmp1, [pmc, #AT91_CKGR_MOR] 136 + bic tmp1, tmp1, #AT91_PMC_MOSCEN 137 + orr tmp1, tmp1, #AT91_PMC_KEY 138 + str tmp1, [pmc, #AT91_CKGR_MOR] 139 + 140 + skip_disable_main_clock: 141 + ldr pmc, .pmc_base 142 + 143 + /* Wait for interrupt */ 144 + at91_cpu_idle 145 + 146 + ldr r0, .pm_mode 147 + tst r0, #AT91_PM_SLOW_CLOCK 148 + beq skip_enable_main_clock 149 + 150 + ldr pmc, .pmc_base 151 + 152 + /* Turn on the main oscillator */ 153 + ldr tmp1, [pmc, #AT91_CKGR_MOR] 154 + orr tmp1, tmp1, #AT91_PMC_MOSCEN 155 + orr tmp1, tmp1, #AT91_PMC_KEY 156 + str tmp1, [pmc, #AT91_CKGR_MOR] 157 + 158 + wait_moscrdy 159 + 160 + /* Restore PLLA setting */ 161 + ldr tmp1, .saved_pllar 162 + str tmp1, [pmc, #AT91_CKGR_PLLAR] 163 + 164 + tst tmp1, #(AT91_PMC_MUL & 0xff0000) 165 + bne 3f 166 + tst tmp1, #(AT91_PMC_MUL & ~0xff0000) 167 + beq 4f 168 + 3: 169 + wait_pllalock 170 + 4: 171 + 172 + /* 173 + * Restore master clock setting 174 + */ 175 + ldr tmp1, .saved_mckr 176 + str tmp1, [pmc, #AT91_PMC_MCKR] 177 + 178 + wait_mckrdy 179 + 180 + skip_enable_main_clock: 181 + /* Exit the self-refresh mode */ 182 + mov r0, #SRAMC_SELF_FRESH_EXIT 183 + bl at91_sramc_self_refresh 184 + 185 + /* Restore registers, and return */ 186 + ldmfd sp!, {r4 - r12, pc} 187 + ENDPROC(at91_pm_suspend_in_sram) 188 + 189 + /* 190 + * void at91_sramc_self_refresh(unsigned int is_active) 191 + * 192 + * @input param: 193 + * @r0: 1 - active self-refresh mode 194 + * 0 - exit self-refresh mode 195 + * register usage: 196 + * @r1: memory type 197 + * @r2: base address of the sram controller 198 + */ 199 + 200 + ENTRY(at91_sramc_self_refresh) 201 + ldr r1, .memtype 202 + ldr r2, .sramc_base 203 + 204 + cmp r1, #AT91_MEMCTRL_MC 205 + bne ddrc_sf 206 + 207 + /* 208 + * at91rm9200 Memory controller 209 + */ 210 + 211 + /* 212 + * For exiting the self-refresh mode, do nothing, 213 + * automatically exit the self-refresh mode. 214 + */ 215 + tst r0, #SRAMC_SELF_FRESH_ACTIVE 216 + beq exit_sramc_sf 217 + 218 + /* Active SDRAM self-refresh mode */ 219 + mov r3, #1 220 + str r3, [r2, #AT91RM9200_SDRAMC_SRR] 221 + b exit_sramc_sf 222 + 223 + ddrc_sf: 224 + cmp r1, #AT91_MEMCTRL_DDRSDR 225 + bne sdramc_sf 226 + 227 + /* 228 + * DDR Memory controller 229 + */ 230 + tst r0, #SRAMC_SELF_FRESH_ACTIVE 231 + beq ddrc_exit_sf 232 + 233 + /* LPDDR1 --> force DDR2 mode during self-refresh */ 234 + ldr r3, [r2, #AT91_DDRSDRC_MDR] 235 + str r3, .saved_sam9_mdr 236 + bic r3, r3, #~AT91_DDRSDRC_MD 237 + cmp r3, #AT91_DDRSDRC_MD_LOW_POWER_DDR 238 + ldreq r3, [r2, #AT91_DDRSDRC_MDR] 239 + biceq r3, r3, #AT91_DDRSDRC_MD 240 + orreq r3, r3, #AT91_DDRSDRC_MD_DDR2 241 + streq r3, [r2, #AT91_DDRSDRC_MDR] 242 + 243 + /* Active DDRC self-refresh mode */ 244 + ldr r3, [r2, #AT91_DDRSDRC_LPR] 245 + str r3, .saved_sam9_lpr 246 + bic r3, r3, #AT91_DDRSDRC_LPCB 247 + orr r3, r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH 248 + str r3, [r2, #AT91_DDRSDRC_LPR] 249 + 250 + /* If using the 2nd ddr controller */ 251 + ldr r2, .sramc1_base 252 + cmp r2, #0 253 + beq no_2nd_ddrc 254 + 255 + ldr r3, [r2, #AT91_DDRSDRC_MDR] 256 + str r3, .saved_sam9_mdr1 257 + bic r3, r3, #~AT91_DDRSDRC_MD 258 + cmp r3, #AT91_DDRSDRC_MD_LOW_POWER_DDR 259 + ldreq r3, [r2, #AT91_DDRSDRC_MDR] 260 + biceq r3, r3, #AT91_DDRSDRC_MD 261 + orreq r3, r3, #AT91_DDRSDRC_MD_DDR2 262 + streq r3, [r2, #AT91_DDRSDRC_MDR] 263 + 264 + /* Active DDRC self-refresh mode */ 265 + ldr r3, [r2, #AT91_DDRSDRC_LPR] 266 + str r3, .saved_sam9_lpr1 267 + bic r3, r3, #AT91_DDRSDRC_LPCB 268 + orr r3, r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH 269 + str r3, [r2, #AT91_DDRSDRC_LPR] 270 + 271 + no_2nd_ddrc: 272 + b exit_sramc_sf 273 + 274 + ddrc_exit_sf: 275 + /* Restore MDR in case of LPDDR1 */ 276 + ldr r3, .saved_sam9_mdr 277 + str r3, [r2, #AT91_DDRSDRC_MDR] 278 + /* Restore LPR on AT91 with DDRAM */ 279 + ldr r3, .saved_sam9_lpr 280 + str r3, [r2, #AT91_DDRSDRC_LPR] 281 + 282 + /* If using the 2nd ddr controller */ 283 + ldr r2, .sramc1_base 284 + cmp r2, #0 285 + ldrne r3, .saved_sam9_mdr1 286 + strne r3, [r2, #AT91_DDRSDRC_MDR] 287 + ldrne r3, .saved_sam9_lpr1 288 + strne r3, [r2, #AT91_DDRSDRC_LPR] 289 + 290 + b exit_sramc_sf 291 + 292 + /* 293 + * SDRAMC Memory controller 294 + */ 295 + sdramc_sf: 296 + tst r0, #SRAMC_SELF_FRESH_ACTIVE 297 + beq sdramc_exit_sf 298 + 299 + /* Active SDRAMC self-refresh mode */ 300 + ldr r3, [r2, #AT91_SDRAMC_LPR] 301 + str r3, .saved_sam9_lpr 302 + bic r3, r3, #AT91_SDRAMC_LPCB 303 + orr r3, r3, #AT91_SDRAMC_LPCB_SELF_REFRESH 304 + str r3, [r2, #AT91_SDRAMC_LPR] 305 + 306 + sdramc_exit_sf: 307 + ldr r3, .saved_sam9_lpr 308 + str r3, [r2, #AT91_SDRAMC_LPR] 309 + 310 + exit_sramc_sf: 311 + mov pc, lr 312 + ENDPROC(at91_sramc_self_refresh) 313 + 314 + .pmc_base: 315 + .word 0 316 + .sramc_base: 317 + .word 0 318 + .sramc1_base: 319 + .word 0 320 + .memtype: 321 + .word 0 322 + .pm_mode: 323 + .word 0 324 + .saved_mckr: 325 + .word 0 326 + .saved_pllar: 327 + .word 0 328 + .saved_sam9_lpr: 329 + .word 0 330 + .saved_sam9_lpr1: 331 + .word 0 332 + .saved_sam9_mdr: 333 + .word 0 334 + .saved_sam9_mdr1: 335 + .word 0 336 + 337 + ENTRY(at91_pm_suspend_in_sram_sz) 338 + .word .-at91_pm_suspend_in_sram
+33 -66
arch/arm/mach-at91/sama5.c
··· 7 7 * Licensed under GPLv2 or later. 8 8 */ 9 9 10 - #include <linux/types.h> 11 - #include <linux/init.h> 12 - #include <linux/module.h> 13 - #include <linux/gpio.h> 14 - #include <linux/micrel_phy.h> 15 10 #include <linux/of.h> 16 - #include <linux/of_irq.h> 17 11 #include <linux/of_platform.h> 18 - #include <linux/phy.h> 19 - #include <linux/clk-provider.h> 20 - #include <linux/phy.h> 12 + 13 + #include <asm/mach/arch.h> 14 + #include <asm/mach/map.h> 15 + #include <asm/system_misc.h> 21 16 22 17 #include <mach/hardware.h> 23 18 24 - #include <asm/setup.h> 25 - #include <asm/irq.h> 26 - #include <asm/mach/arch.h> 27 - #include <asm/mach/map.h> 28 - #include <asm/mach/irq.h> 29 - 30 19 #include "generic.h" 20 + #include "soc.h" 31 21 32 - static int ksz8081_phy_fixup(struct phy_device *phy) 33 - { 34 - int value; 35 - 36 - value = phy_read(phy, 0x16); 37 - value &= ~0x20; 38 - phy_write(phy, 0x16, value); 39 - 40 - return 0; 41 - } 22 + static const struct at91_soc sama5_socs[] = { 23 + AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D31_EXID_MATCH, 24 + "sama5d31", "sama5d3"), 25 + AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D33_EXID_MATCH, 26 + "sama5d33", "sama5d3"), 27 + AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D34_EXID_MATCH, 28 + "sama5d34", "sama5d3"), 29 + AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D35_EXID_MATCH, 30 + "sama5d35", "sama5d3"), 31 + AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D36_EXID_MATCH, 32 + "sama5d36", "sama5d3"), 33 + AT91_SOC(SAMA5D4_CIDR_MATCH, SAMA5D41_EXID_MATCH, 34 + "sama5d41", "sama5d4"), 35 + AT91_SOC(SAMA5D4_CIDR_MATCH, SAMA5D42_EXID_MATCH, 36 + "sama5d42", "sama5d4"), 37 + AT91_SOC(SAMA5D4_CIDR_MATCH, SAMA5D43_EXID_MATCH, 38 + "sama5d43", "sama5d4"), 39 + AT91_SOC(SAMA5D4_CIDR_MATCH, SAMA5D44_EXID_MATCH, 40 + "sama5d44", "sama5d4"), 41 + { /* sentinel */ }, 42 + }; 42 43 43 44 static void __init sama5_dt_device_init(void) 44 45 { 45 - if (of_machine_is_compatible("atmel,sama5d4ek") && 46 - IS_ENABLED(CONFIG_PHYLIB)) { 47 - phy_register_fixup_for_id("fc028000.etherne:00", 48 - ksz8081_phy_fixup); 49 - } 46 + struct soc_device *soc; 47 + struct device *soc_dev = NULL; 50 48 51 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 49 + soc = at91_soc_init(sama5_socs); 50 + if (soc != NULL) 51 + soc_dev = soc_device_to_device(soc); 52 + 53 + of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); 52 54 at91sam9x5_pm_init(); 53 55 } 54 56 ··· 61 59 62 60 DT_MACHINE_START(sama5_dt, "Atmel SAMA5") 63 61 /* Maintainer: Atmel */ 64 - .map_io = at91_map_io, 65 62 .init_machine = sama5_dt_device_init, 66 63 .dt_compat = sama5_dt_board_compat, 67 64 MACHINE_END 68 - 69 - static struct map_desc at91_io_desc[] __initdata = { 70 - { 71 - .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_MPDDRC), 72 - .pfn = __phys_to_pfn(SAMA5D4_BASE_MPDDRC), 73 - .length = SZ_512, 74 - .type = MT_DEVICE, 75 - }, 76 - { 77 - .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_PMC), 78 - .pfn = __phys_to_pfn(SAMA5D4_BASE_PMC), 79 - .length = SZ_512, 80 - .type = MT_DEVICE, 81 - }, 82 - { /* On sama5d4, we use USART3 as serial console */ 83 - .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_USART3), 84 - .pfn = __phys_to_pfn(SAMA5D4_BASE_USART3), 85 - .length = SZ_256, 86 - .type = MT_DEVICE, 87 - }, 88 - { /* A bunch of peripheral with fine grained IO space */ 89 - .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_SYS2), 90 - .pfn = __phys_to_pfn(SAMA5D4_BASE_SYS2), 91 - .length = SZ_2K, 92 - .type = MT_DEVICE, 93 - }, 94 - }; 95 - 96 - static void __init sama5_alt_map_io(void) 97 - { 98 - at91_alt_map_io(); 99 - iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc)); 100 - } 101 65 102 66 static const char *sama5_alt_dt_board_compat[] __initconst = { 103 67 "atmel,sama5d4", ··· 72 104 73 105 DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5") 74 106 /* Maintainer: Atmel */ 75 - .map_io = sama5_alt_map_io, 76 107 .init_machine = sama5_dt_device_init, 77 108 .dt_compat = sama5_alt_dt_board_compat, 78 109 .l2c_aux_mask = ~0UL,
-330
arch/arm/mach-at91/setup.c
··· 1 - /* 2 - * Copyright (C) 2007 Atmel Corporation. 3 - * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> 4 - * 5 - * Under GPLv2 6 - */ 7 - 8 - #define pr_fmt(fmt) "AT91: " fmt 9 - 10 - #include <linux/module.h> 11 - #include <linux/io.h> 12 - #include <linux/mm.h> 13 - #include <linux/pm.h> 14 - #include <linux/of_address.h> 15 - #include <linux/pinctrl/machine.h> 16 - #include <linux/clk/at91_pmc.h> 17 - 18 - #include <asm/system_misc.h> 19 - #include <asm/mach/map.h> 20 - 21 - #include <mach/hardware.h> 22 - #include <mach/cpu.h> 23 - #include <mach/at91_dbgu.h> 24 - 25 - #include "generic.h" 26 - #include "pm.h" 27 - 28 - struct at91_socinfo at91_soc_initdata; 29 - EXPORT_SYMBOL(at91_soc_initdata); 30 - 31 - static struct map_desc at91_io_desc __initdata __maybe_unused = { 32 - .virtual = (unsigned long)AT91_VA_BASE_SYS, 33 - .pfn = __phys_to_pfn(AT91_BASE_SYS), 34 - .length = SZ_16K, 35 - .type = MT_DEVICE, 36 - }; 37 - 38 - static struct map_desc at91_alt_io_desc __initdata __maybe_unused = { 39 - .virtual = (unsigned long)AT91_ALT_VA_BASE_SYS, 40 - .pfn = __phys_to_pfn(AT91_ALT_BASE_SYS), 41 - .length = 24 * SZ_1K, 42 - .type = MT_DEVICE, 43 - }; 44 - 45 - static void __init soc_detect(u32 dbgu_base) 46 - { 47 - u32 cidr, socid; 48 - 49 - cidr = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_CIDR); 50 - socid = cidr & ~AT91_CIDR_VERSION; 51 - 52 - switch (socid) { 53 - case ARCH_ID_AT91RM9200: 54 - at91_soc_initdata.type = AT91_SOC_RM9200; 55 - if (at91_soc_initdata.subtype == AT91_SOC_SUBTYPE_UNKNOWN) 56 - at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA; 57 - break; 58 - 59 - case ARCH_ID_AT91SAM9260: 60 - at91_soc_initdata.type = AT91_SOC_SAM9260; 61 - at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 62 - break; 63 - 64 - case ARCH_ID_AT91SAM9261: 65 - at91_soc_initdata.type = AT91_SOC_SAM9261; 66 - at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 67 - break; 68 - 69 - case ARCH_ID_AT91SAM9263: 70 - at91_soc_initdata.type = AT91_SOC_SAM9263; 71 - at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 72 - break; 73 - 74 - case ARCH_ID_AT91SAM9G20: 75 - at91_soc_initdata.type = AT91_SOC_SAM9G20; 76 - at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 77 - break; 78 - 79 - case ARCH_ID_AT91SAM9G45: 80 - at91_soc_initdata.type = AT91_SOC_SAM9G45; 81 - if (cidr == ARCH_ID_AT91SAM9G45ES) 82 - at91_soc_initdata.subtype = AT91_SOC_SAM9G45ES; 83 - break; 84 - 85 - case ARCH_ID_AT91SAM9RL64: 86 - at91_soc_initdata.type = AT91_SOC_SAM9RL; 87 - at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 88 - break; 89 - 90 - case ARCH_ID_AT91SAM9X5: 91 - at91_soc_initdata.type = AT91_SOC_SAM9X5; 92 - break; 93 - 94 - case ARCH_ID_AT91SAM9N12: 95 - at91_soc_initdata.type = AT91_SOC_SAM9N12; 96 - break; 97 - 98 - case ARCH_ID_SAMA5: 99 - at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID); 100 - if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) { 101 - at91_soc_initdata.type = AT91_SOC_SAMA5D3; 102 - } 103 - break; 104 - } 105 - 106 - /* at91sam9g10 */ 107 - if ((socid & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) { 108 - at91_soc_initdata.type = AT91_SOC_SAM9G10; 109 - at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 110 - } 111 - /* at91sam9xe */ 112 - else if ((cidr & AT91_CIDR_ARCH) == ARCH_FAMILY_AT91SAM9XE) { 113 - at91_soc_initdata.type = AT91_SOC_SAM9260; 114 - at91_soc_initdata.subtype = AT91_SOC_SAM9XE; 115 - } 116 - 117 - if (!at91_soc_is_detected()) 118 - return; 119 - 120 - at91_soc_initdata.cidr = cidr; 121 - 122 - /* sub version of soc */ 123 - if (!at91_soc_initdata.exid) 124 - at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID); 125 - 126 - if (at91_soc_initdata.type == AT91_SOC_SAM9G45) { 127 - switch (at91_soc_initdata.exid) { 128 - case ARCH_EXID_AT91SAM9M10: 129 - at91_soc_initdata.subtype = AT91_SOC_SAM9M10; 130 - break; 131 - case ARCH_EXID_AT91SAM9G46: 132 - at91_soc_initdata.subtype = AT91_SOC_SAM9G46; 133 - break; 134 - case ARCH_EXID_AT91SAM9M11: 135 - at91_soc_initdata.subtype = AT91_SOC_SAM9M11; 136 - break; 137 - } 138 - } 139 - 140 - if (at91_soc_initdata.type == AT91_SOC_SAM9X5) { 141 - switch (at91_soc_initdata.exid) { 142 - case ARCH_EXID_AT91SAM9G15: 143 - at91_soc_initdata.subtype = AT91_SOC_SAM9G15; 144 - break; 145 - case ARCH_EXID_AT91SAM9G35: 146 - at91_soc_initdata.subtype = AT91_SOC_SAM9G35; 147 - break; 148 - case ARCH_EXID_AT91SAM9X35: 149 - at91_soc_initdata.subtype = AT91_SOC_SAM9X35; 150 - break; 151 - case ARCH_EXID_AT91SAM9G25: 152 - at91_soc_initdata.subtype = AT91_SOC_SAM9G25; 153 - break; 154 - case ARCH_EXID_AT91SAM9X25: 155 - at91_soc_initdata.subtype = AT91_SOC_SAM9X25; 156 - break; 157 - } 158 - } 159 - 160 - if (at91_soc_initdata.type == AT91_SOC_SAMA5D3) { 161 - switch (at91_soc_initdata.exid) { 162 - case ARCH_EXID_SAMA5D31: 163 - at91_soc_initdata.subtype = AT91_SOC_SAMA5D31; 164 - break; 165 - case ARCH_EXID_SAMA5D33: 166 - at91_soc_initdata.subtype = AT91_SOC_SAMA5D33; 167 - break; 168 - case ARCH_EXID_SAMA5D34: 169 - at91_soc_initdata.subtype = AT91_SOC_SAMA5D34; 170 - break; 171 - case ARCH_EXID_SAMA5D35: 172 - at91_soc_initdata.subtype = AT91_SOC_SAMA5D35; 173 - break; 174 - case ARCH_EXID_SAMA5D36: 175 - at91_soc_initdata.subtype = AT91_SOC_SAMA5D36; 176 - break; 177 - } 178 - } 179 - } 180 - 181 - static void __init alt_soc_detect(u32 dbgu_base) 182 - { 183 - u32 cidr, socid; 184 - 185 - /* SoC ID */ 186 - cidr = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_CIDR); 187 - socid = cidr & ~AT91_CIDR_VERSION; 188 - 189 - switch (socid) { 190 - case ARCH_ID_SAMA5: 191 - at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID); 192 - if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) { 193 - at91_soc_initdata.type = AT91_SOC_SAMA5D3; 194 - } else if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D4) { 195 - at91_soc_initdata.type = AT91_SOC_SAMA5D4; 196 - } 197 - break; 198 - } 199 - 200 - if (!at91_soc_is_detected()) 201 - return; 202 - 203 - at91_soc_initdata.cidr = cidr; 204 - 205 - /* sub version of soc */ 206 - if (!at91_soc_initdata.exid) 207 - at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID); 208 - 209 - if (at91_soc_initdata.type == AT91_SOC_SAMA5D4) { 210 - switch (at91_soc_initdata.exid) { 211 - case ARCH_EXID_SAMA5D41: 212 - at91_soc_initdata.subtype = AT91_SOC_SAMA5D41; 213 - break; 214 - case ARCH_EXID_SAMA5D42: 215 - at91_soc_initdata.subtype = AT91_SOC_SAMA5D42; 216 - break; 217 - case ARCH_EXID_SAMA5D43: 218 - at91_soc_initdata.subtype = AT91_SOC_SAMA5D43; 219 - break; 220 - case ARCH_EXID_SAMA5D44: 221 - at91_soc_initdata.subtype = AT91_SOC_SAMA5D44; 222 - break; 223 - } 224 - } 225 - } 226 - 227 - static const char *soc_name[] = { 228 - [AT91_SOC_RM9200] = "at91rm9200", 229 - [AT91_SOC_SAM9260] = "at91sam9260", 230 - [AT91_SOC_SAM9261] = "at91sam9261", 231 - [AT91_SOC_SAM9263] = "at91sam9263", 232 - [AT91_SOC_SAM9G10] = "at91sam9g10", 233 - [AT91_SOC_SAM9G20] = "at91sam9g20", 234 - [AT91_SOC_SAM9G45] = "at91sam9g45", 235 - [AT91_SOC_SAM9RL] = "at91sam9rl", 236 - [AT91_SOC_SAM9X5] = "at91sam9x5", 237 - [AT91_SOC_SAM9N12] = "at91sam9n12", 238 - [AT91_SOC_SAMA5D3] = "sama5d3", 239 - [AT91_SOC_SAMA5D4] = "sama5d4", 240 - [AT91_SOC_UNKNOWN] = "Unknown", 241 - }; 242 - 243 - const char *at91_get_soc_type(struct at91_socinfo *c) 244 - { 245 - return soc_name[c->type]; 246 - } 247 - EXPORT_SYMBOL(at91_get_soc_type); 248 - 249 - static const char *soc_subtype_name[] = { 250 - [AT91_SOC_RM9200_BGA] = "at91rm9200 BGA", 251 - [AT91_SOC_RM9200_PQFP] = "at91rm9200 PQFP", 252 - [AT91_SOC_SAM9XE] = "at91sam9xe", 253 - [AT91_SOC_SAM9G45ES] = "at91sam9g45es", 254 - [AT91_SOC_SAM9M10] = "at91sam9m10", 255 - [AT91_SOC_SAM9G46] = "at91sam9g46", 256 - [AT91_SOC_SAM9M11] = "at91sam9m11", 257 - [AT91_SOC_SAM9G15] = "at91sam9g15", 258 - [AT91_SOC_SAM9G35] = "at91sam9g35", 259 - [AT91_SOC_SAM9X35] = "at91sam9x35", 260 - [AT91_SOC_SAM9G25] = "at91sam9g25", 261 - [AT91_SOC_SAM9X25] = "at91sam9x25", 262 - [AT91_SOC_SAMA5D31] = "sama5d31", 263 - [AT91_SOC_SAMA5D33] = "sama5d33", 264 - [AT91_SOC_SAMA5D34] = "sama5d34", 265 - [AT91_SOC_SAMA5D35] = "sama5d35", 266 - [AT91_SOC_SAMA5D36] = "sama5d36", 267 - [AT91_SOC_SAMA5D41] = "sama5d41", 268 - [AT91_SOC_SAMA5D42] = "sama5d42", 269 - [AT91_SOC_SAMA5D43] = "sama5d43", 270 - [AT91_SOC_SAMA5D44] = "sama5d44", 271 - [AT91_SOC_SUBTYPE_NONE] = "None", 272 - [AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown", 273 - }; 274 - 275 - const char *at91_get_soc_subtype(struct at91_socinfo *c) 276 - { 277 - return soc_subtype_name[c->subtype]; 278 - } 279 - EXPORT_SYMBOL(at91_get_soc_subtype); 280 - 281 - void __init at91_map_io(void) 282 - { 283 - /* Map peripherals */ 284 - iotable_init(&at91_io_desc, 1); 285 - 286 - at91_soc_initdata.type = AT91_SOC_UNKNOWN; 287 - at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_UNKNOWN; 288 - 289 - soc_detect(AT91_BASE_DBGU0); 290 - if (!at91_soc_is_detected()) 291 - soc_detect(AT91_BASE_DBGU1); 292 - 293 - if (!at91_soc_is_detected()) 294 - panic(pr_fmt("Impossible to detect the SOC type")); 295 - 296 - pr_info("Detected soc type: %s\n", 297 - at91_get_soc_type(&at91_soc_initdata)); 298 - if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE) 299 - pr_info("Detected soc subtype: %s\n", 300 - at91_get_soc_subtype(&at91_soc_initdata)); 301 - } 302 - 303 - void __init at91_alt_map_io(void) 304 - { 305 - /* Map peripherals */ 306 - iotable_init(&at91_alt_io_desc, 1); 307 - 308 - at91_soc_initdata.type = AT91_SOC_UNKNOWN; 309 - at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_UNKNOWN; 310 - 311 - alt_soc_detect(AT91_BASE_DBGU2); 312 - if (!at91_soc_is_detected()) 313 - panic("AT91: Impossible to detect the SOC type"); 314 - 315 - pr_info("AT91: Detected soc type: %s\n", 316 - at91_get_soc_type(&at91_soc_initdata)); 317 - if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE) 318 - pr_info("AT91: Detected soc subtype: %s\n", 319 - at91_get_soc_subtype(&at91_soc_initdata)); 320 - } 321 - 322 - void __iomem *at91_matrix_base; 323 - EXPORT_SYMBOL_GPL(at91_matrix_base); 324 - 325 - void __init at91_ioremap_matrix(u32 base_addr) 326 - { 327 - at91_matrix_base = ioremap(base_addr, 512); 328 - if (!at91_matrix_base) 329 - panic(pr_fmt("Impossible to ioremap at91_matrix_base\n")); 330 - }
+97
arch/arm/mach-at91/soc.c
··· 1 + /* 2 + * Copyright (C) 2015 Atmel 3 + * 4 + * Alexandre Belloni <alexandre.belloni@free-electrons.com 5 + * Boris Brezillon <boris.brezillon@free-electrons.com 6 + * 7 + * This file is licensed under the terms of the GNU General Public 8 + * License version 2. This program is licensed "as is" without any 9 + * warranty of any kind, whether express or implied. 10 + * 11 + */ 12 + 13 + #define pr_fmt(fmt) "AT91: " fmt 14 + 15 + #include <linux/io.h> 16 + #include <linux/of.h> 17 + #include <linux/of_address.h> 18 + #include <linux/of_platform.h> 19 + #include <linux/slab.h> 20 + #include <linux/sys_soc.h> 21 + 22 + #include "soc.h" 23 + 24 + #define AT91_DBGU_CIDR 0x40 25 + #define AT91_DBGU_CIDR_VERSION(x) ((x) & 0x1f) 26 + #define AT91_DBGU_CIDR_EXT BIT(31) 27 + #define AT91_DBGU_CIDR_MATCH_MASK 0x7fffffe0 28 + #define AT91_DBGU_EXID 0x44 29 + 30 + struct soc_device * __init at91_soc_init(const struct at91_soc *socs) 31 + { 32 + struct soc_device_attribute *soc_dev_attr; 33 + const struct at91_soc *soc; 34 + struct soc_device *soc_dev; 35 + struct device_node *np; 36 + void __iomem *regs; 37 + u32 cidr, exid; 38 + 39 + np = of_find_compatible_node(NULL, NULL, "atmel,at91rm9200-dbgu"); 40 + if (!np) 41 + np = of_find_compatible_node(NULL, NULL, 42 + "atmel,at91sam9260-dbgu"); 43 + 44 + if (!np) { 45 + pr_warn("Could not find DBGU node"); 46 + return NULL; 47 + } 48 + 49 + regs = of_iomap(np, 0); 50 + of_node_put(np); 51 + 52 + if (!regs) { 53 + pr_warn("Could not map DBGU iomem range"); 54 + return NULL; 55 + } 56 + 57 + cidr = readl(regs + AT91_DBGU_CIDR); 58 + exid = readl(regs + AT91_DBGU_EXID); 59 + 60 + iounmap(regs); 61 + 62 + for (soc = socs; soc->name; soc++) { 63 + if (soc->cidr_match != (cidr & AT91_DBGU_CIDR_MATCH_MASK)) 64 + continue; 65 + 66 + if (!(cidr & AT91_DBGU_CIDR_EXT) || soc->exid_match == exid) 67 + break; 68 + } 69 + 70 + if (!soc->name) { 71 + pr_warn("Could not find matching SoC description\n"); 72 + return NULL; 73 + } 74 + 75 + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 76 + if (!soc_dev_attr) 77 + return NULL; 78 + 79 + soc_dev_attr->family = soc->family; 80 + soc_dev_attr->soc_id = soc->name; 81 + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%X", 82 + AT91_DBGU_CIDR_VERSION(cidr)); 83 + soc_dev = soc_device_register(soc_dev_attr); 84 + if (IS_ERR(soc_dev)) { 85 + kfree(soc_dev_attr->revision); 86 + kfree(soc_dev_attr); 87 + pr_warn("Could not register SoC device\n"); 88 + return NULL; 89 + } 90 + 91 + if (soc->family) 92 + pr_info("Detected SoC family: %s\n", soc->family); 93 + pr_info("Detected SoC: %s, revision %X\n", soc->name, 94 + AT91_DBGU_CIDR_VERSION(cidr)); 95 + 96 + return soc_dev; 97 + }
+78
arch/arm/mach-at91/soc.h
··· 1 + /* 2 + * Copyright (C) 2015 Atmel 3 + * 4 + * Boris Brezillon <boris.brezillon@free-electrons.com 5 + * 6 + * This file is licensed under the terms of the GNU General Public 7 + * License version 2. This program is licensed "as is" without any 8 + * warranty of any kind, whether express or implied. 9 + * 10 + */ 11 + 12 + #ifndef __AT91_SOC_H 13 + #define __AT91_SOC_H 14 + 15 + #include <linux/sys_soc.h> 16 + 17 + struct at91_soc { 18 + u32 cidr_match; 19 + u32 exid_match; 20 + const char *name; 21 + const char *family; 22 + }; 23 + 24 + #define AT91_SOC(__cidr, __exid, __name, __family) \ 25 + { \ 26 + .cidr_match = (__cidr), \ 27 + .exid_match = (__exid), \ 28 + .name = (__name), \ 29 + .family = (__family), \ 30 + } 31 + 32 + struct soc_device * __init 33 + at91_soc_init(const struct at91_soc *socs); 34 + 35 + #define AT91RM9200_CIDR_MATCH 0x09290780 36 + 37 + #define AT91SAM9260_CIDR_MATCH 0x019803a0 38 + #define AT91SAM9261_CIDR_MATCH 0x019703a0 39 + #define AT91SAM9263_CIDR_MATCH 0x019607a0 40 + #define AT91SAM9G20_CIDR_MATCH 0x019905a0 41 + #define AT91SAM9RL64_CIDR_MATCH 0x019b03a0 42 + #define AT91SAM9G45_CIDR_MATCH 0x019b05a0 43 + #define AT91SAM9X5_CIDR_MATCH 0x019a05a0 44 + #define AT91SAM9N12_CIDR_MATCH 0x019a07a0 45 + 46 + #define AT91SAM9M11_EXID_MATCH 0x00000001 47 + #define AT91SAM9M10_EXID_MATCH 0x00000002 48 + #define AT91SAM9G46_EXID_MATCH 0x00000003 49 + #define AT91SAM9G45_EXID_MATCH 0x00000004 50 + 51 + #define AT91SAM9G15_EXID_MATCH 0x00000000 52 + #define AT91SAM9G35_EXID_MATCH 0x00000001 53 + #define AT91SAM9X35_EXID_MATCH 0x00000002 54 + #define AT91SAM9G25_EXID_MATCH 0x00000003 55 + #define AT91SAM9X25_EXID_MATCH 0x00000004 56 + 57 + #define AT91SAM9CN12_EXID_MATCH 0x00000005 58 + #define AT91SAM9N12_EXID_MATCH 0x00000006 59 + #define AT91SAM9CN11_EXID_MATCH 0x00000009 60 + 61 + #define AT91SAM9XE128_CIDR_MATCH 0x329973a0 62 + #define AT91SAM9XE256_CIDR_MATCH 0x329a93a0 63 + #define AT91SAM9XE512_CIDR_MATCH 0x329aa3a0 64 + 65 + #define SAMA5D3_CIDR_MATCH 0x0a5c07c0 66 + #define SAMA5D31_EXID_MATCH 0x00444300 67 + #define SAMA5D33_EXID_MATCH 0x00414300 68 + #define SAMA5D34_EXID_MATCH 0x00414301 69 + #define SAMA5D35_EXID_MATCH 0x00584300 70 + #define SAMA5D36_EXID_MATCH 0x00004301 71 + 72 + #define SAMA5D4_CIDR_MATCH 0x0a5c07c0 73 + #define SAMA5D41_EXID_MATCH 0x00000001 74 + #define SAMA5D42_EXID_MATCH 0x00000002 75 + #define SAMA5D43_EXID_MATCH 0x00000003 76 + #define SAMA5D44_EXID_MATCH 0x00000004 77 + 78 + #endif /* __AT91_SOC_H */
+7
arch/arm/mach-davinci/asp.h
··· 21 21 /* Bases of da830 McASP1 register banks */ 22 22 #define DAVINCI_DA830_MCASP1_REG_BASE 0x01D04000 23 23 24 + /* Bases of da830 McASP2 register banks */ 25 + #define DAVINCI_DA830_MCASP2_REG_BASE 0x01D08000 26 + 24 27 /* EDMA channels of dm644x and dm355 */ 25 28 #define DAVINCI_DMA_ASP0_TX 2 26 29 #define DAVINCI_DMA_ASP0_RX 3 ··· 42 39 /* EDMA channels of da830 McASP1 */ 43 40 #define DAVINCI_DA830_DMA_MCASP1_AREVT 2 44 41 #define DAVINCI_DA830_DMA_MCASP1_AXEVT 3 42 + 43 + /* EDMA channels of da830 McASP2 */ 44 + #define DAVINCI_DA830_DMA_MCASP2_AREVT 4 45 + #define DAVINCI_DA830_DMA_MCASP2_AXEVT 5 45 46 46 47 /* Interrupts */ 47 48 #define DAVINCI_ASP0_RX_INT IRQ_MBRINT
+73 -7
arch/arm/mach-davinci/devices-da8xx.c
··· 463 463 }, 464 464 /* TX event */ 465 465 { 466 + .name = "tx", 466 467 .start = DAVINCI_DA830_DMA_MCASP1_AXEVT, 467 468 .end = DAVINCI_DA830_DMA_MCASP1_AXEVT, 468 469 .flags = IORESOURCE_DMA, 469 470 }, 470 471 /* RX event */ 471 472 { 473 + .name = "rx", 472 474 .start = DAVINCI_DA830_DMA_MCASP1_AREVT, 473 475 .end = DAVINCI_DA830_DMA_MCASP1_AREVT, 474 476 .flags = IORESOURCE_DMA, 477 + }, 478 + { 479 + .name = "common", 480 + .start = IRQ_DA8XX_MCASPINT, 481 + .flags = IORESOURCE_IRQ, 475 482 }, 476 483 }; 477 484 ··· 487 480 .id = 1, 488 481 .num_resources = ARRAY_SIZE(da830_mcasp1_resources), 489 482 .resource = da830_mcasp1_resources, 483 + }; 484 + 485 + static struct resource da830_mcasp2_resources[] = { 486 + { 487 + .name = "mpu", 488 + .start = DAVINCI_DA830_MCASP2_REG_BASE, 489 + .end = DAVINCI_DA830_MCASP2_REG_BASE + (SZ_1K * 12) - 1, 490 + .flags = IORESOURCE_MEM, 491 + }, 492 + /* TX event */ 493 + { 494 + .name = "tx", 495 + .start = DAVINCI_DA830_DMA_MCASP2_AXEVT, 496 + .end = DAVINCI_DA830_DMA_MCASP2_AXEVT, 497 + .flags = IORESOURCE_DMA, 498 + }, 499 + /* RX event */ 500 + { 501 + .name = "rx", 502 + .start = DAVINCI_DA830_DMA_MCASP2_AREVT, 503 + .end = DAVINCI_DA830_DMA_MCASP2_AREVT, 504 + .flags = IORESOURCE_DMA, 505 + }, 506 + { 507 + .name = "common", 508 + .start = IRQ_DA8XX_MCASPINT, 509 + .flags = IORESOURCE_IRQ, 510 + }, 511 + }; 512 + 513 + static struct platform_device da830_mcasp2_device = { 514 + .name = "davinci-mcasp", 515 + .id = 2, 516 + .num_resources = ARRAY_SIZE(da830_mcasp2_resources), 517 + .resource = da830_mcasp2_resources, 490 518 }; 491 519 492 520 static struct resource da850_mcasp_resources[] = { ··· 533 491 }, 534 492 /* TX event */ 535 493 { 494 + .name = "tx", 536 495 .start = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, 537 496 .end = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, 538 497 .flags = IORESOURCE_DMA, 539 498 }, 540 499 /* RX event */ 541 500 { 501 + .name = "rx", 542 502 .start = DAVINCI_DA8XX_DMA_MCASP0_AREVT, 543 503 .end = DAVINCI_DA8XX_DMA_MCASP0_AREVT, 544 504 .flags = IORESOURCE_DMA, 505 + }, 506 + { 507 + .name = "common", 508 + .start = IRQ_DA8XX_MCASPINT, 509 + .flags = IORESOURCE_IRQ, 545 510 }, 546 511 }; 547 512 ··· 561 512 562 513 void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata) 563 514 { 564 - /* DA830/OMAP-L137 has 3 instances of McASP */ 565 - if (cpu_is_davinci_da830() && id == 1) { 566 - da830_mcasp1_device.dev.platform_data = pdata; 567 - platform_device_register(&da830_mcasp1_device); 568 - } else if (cpu_is_davinci_da850()) { 569 - da850_mcasp_device.dev.platform_data = pdata; 570 - platform_device_register(&da850_mcasp_device); 515 + struct platform_device *pdev; 516 + 517 + switch (id) { 518 + case 0: 519 + /* Valid for DA830/OMAP-L137 or DA850/OMAP-L138 */ 520 + pdev = &da850_mcasp_device; 521 + break; 522 + case 1: 523 + /* Valid for DA830/OMAP-L137 only */ 524 + if (!cpu_is_davinci_da830()) 525 + return; 526 + pdev = &da830_mcasp1_device; 527 + break; 528 + case 2: 529 + /* Valid for DA830/OMAP-L137 only */ 530 + if (!cpu_is_davinci_da830()) 531 + return; 532 + pdev = &da830_mcasp2_device; 533 + break; 534 + default: 535 + return; 571 536 } 537 + 538 + pdev->dev.platform_data = pdata; 539 + platform_device_register(pdev); 572 540 } 573 541 574 542 static struct resource da8xx_pruss_resources[] = {
+17 -7
arch/arm/mach-davinci/dm646x.c
··· 493 493 [IRQ_DM646X_EMACMISCINT] = 7, 494 494 [IRQ_DM646X_MCASP0TXINT] = 7, 495 495 [IRQ_DM646X_MCASP0RXINT] = 7, 496 - [IRQ_AEMIFINT] = 7, 497 496 [IRQ_DM646X_RESERVED_3] = 7, 498 497 [IRQ_DM646X_MCASP1TXINT] = 7, /* clockevent */ 499 498 [IRQ_TINT0_TINT34] = 7, /* clocksource */ ··· 609 610 .end = DAVINCI_DM646X_MCASP0_REG_BASE + (SZ_1K << 1) - 1, 610 611 .flags = IORESOURCE_MEM, 611 612 }, 612 - /* first TX, then RX */ 613 613 { 614 + .name = "tx", 614 615 .start = DAVINCI_DM646X_DMA_MCASP0_AXEVT0, 615 616 .end = DAVINCI_DM646X_DMA_MCASP0_AXEVT0, 616 617 .flags = IORESOURCE_DMA, 617 618 }, 618 619 { 620 + .name = "rx", 619 621 .start = DAVINCI_DM646X_DMA_MCASP0_AREVT0, 620 622 .end = DAVINCI_DM646X_DMA_MCASP0_AREVT0, 621 623 .flags = IORESOURCE_DMA, 622 624 }, 625 + { 626 + .name = "tx", 627 + .start = IRQ_DM646X_MCASP0TXINT, 628 + .flags = IORESOURCE_IRQ, 629 + }, 630 + { 631 + .name = "rx", 632 + .start = IRQ_DM646X_MCASP0RXINT, 633 + .flags = IORESOURCE_IRQ, 634 + }, 623 635 }; 624 636 637 + /* DIT mode only, rx is not supported */ 625 638 static struct resource dm646x_mcasp1_resources[] = { 626 639 { 627 640 .name = "mpu", ··· 641 630 .end = DAVINCI_DM646X_MCASP1_REG_BASE + (SZ_1K << 1) - 1, 642 631 .flags = IORESOURCE_MEM, 643 632 }, 644 - /* DIT mode, only TX event */ 645 633 { 634 + .name = "tx", 646 635 .start = DAVINCI_DM646X_DMA_MCASP1_AXEVT1, 647 636 .end = DAVINCI_DM646X_DMA_MCASP1_AXEVT1, 648 637 .flags = IORESOURCE_DMA, 649 638 }, 650 - /* DIT mode, dummy entry */ 651 639 { 652 - .start = -1, 653 - .end = -1, 654 - .flags = IORESOURCE_DMA, 640 + .name = "tx", 641 + .start = IRQ_DM646X_MCASP1TXINT, 642 + .flags = IORESOURCE_IRQ, 655 643 }, 656 644 }; 657 645
+1 -1
arch/arm/mach-davinci/include/mach/irqs.h
··· 129 129 #define IRQ_DM646X_EMACMISCINT 27 130 130 #define IRQ_DM646X_MCASP0TXINT 28 131 131 #define IRQ_DM646X_MCASP0RXINT 29 132 + #define IRQ_DM646X_MCASP1TXINT 30 132 133 #define IRQ_DM646X_RESERVED_3 31 133 - #define IRQ_DM646X_MCASP1TXINT 32 134 134 #define IRQ_DM646X_VLQINT 38 135 135 #define IRQ_DM646X_UARTINT2 42 136 136 #define IRQ_DM646X_SPINT0 43
+16 -65
arch/arm/mach-imx/Kconfig
··· 77 77 select IMX_HAVE_IOMUX_V1 78 78 select MXC_AVIC 79 79 80 - config SOC_IMX25 81 - bool 82 - select ARCH_MXC_IOMUX_V3 83 - select CPU_ARM926T 84 - select MXC_AVIC 85 - select PINCTRL_IMX25 86 - 87 80 config SOC_IMX27 88 81 bool 89 82 select CPU_ARM926T ··· 141 148 help 142 149 Include support for MX21ADS platform. This includes specific 143 150 configurations for the board and its peripherals. 144 - 145 - comment "MX25 platforms:" 146 - 147 - config MACH_MX25_3DS 148 - bool "Support MX25PDK (3DS) Platform" 149 - select IMX_HAVE_PLATFORM_FLEXCAN 150 - select IMX_HAVE_PLATFORM_FSL_USB2_UDC 151 - select IMX_HAVE_PLATFORM_IMX2_WDT 152 - select IMX_HAVE_PLATFORM_IMXDI_RTC 153 - select IMX_HAVE_PLATFORM_IMX_FB 154 - select IMX_HAVE_PLATFORM_IMX_I2C 155 - select IMX_HAVE_PLATFORM_IMX_KEYPAD 156 - select IMX_HAVE_PLATFORM_IMX_UART 157 - select IMX_HAVE_PLATFORM_MXC_EHCI 158 - select IMX_HAVE_PLATFORM_MXC_NAND 159 - select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 160 - select SOC_IMX25 161 - 162 - config MACH_EUKREA_CPUIMX25SD 163 - bool "Support Eukrea CPUIMX25 Platform" 164 - select IMX_HAVE_PLATFORM_FLEXCAN 165 - select IMX_HAVE_PLATFORM_FSL_USB2_UDC 166 - select IMX_HAVE_PLATFORM_IMX2_WDT 167 - select IMX_HAVE_PLATFORM_IMXDI_RTC 168 - select IMX_HAVE_PLATFORM_IMX_FB 169 - select IMX_HAVE_PLATFORM_IMX_I2C 170 - select IMX_HAVE_PLATFORM_IMX_UART 171 - select IMX_HAVE_PLATFORM_MXC_EHCI 172 - select IMX_HAVE_PLATFORM_MXC_NAND 173 - select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 174 - select USB_ULPI_VIEWPORT if USB_ULPI 175 - select SOC_IMX25 176 - 177 - choice 178 - prompt "Baseboard" 179 - depends on MACH_EUKREA_CPUIMX25SD 180 - default MACH_EUKREA_MBIMXSD25_BASEBOARD 181 - 182 - config MACH_EUKREA_MBIMXSD25_BASEBOARD 183 - bool "Eukrea MBIMXSD development board" 184 - select IMX_HAVE_PLATFORM_GPIO_KEYS 185 - select IMX_HAVE_PLATFORM_IMX_SSI 186 - select IMX_HAVE_PLATFORM_SPI_IMX 187 - select LEDS_GPIO_REGISTER 188 - help 189 - This adds board specific devices that can be found on Eukrea's 190 - MBIMXSD evaluation board. 191 - 192 - endchoice 193 - 194 - config MACH_IMX25_DT 195 - bool "Support i.MX25 platforms from device tree" 196 - select SOC_IMX25 197 - help 198 - Include support for Freescale i.MX25 based platforms 199 - using the device tree for discovery 200 151 201 152 comment "MX27 platforms:" 202 153 ··· 494 557 495 558 endif 496 559 560 + if ARCH_MULTI_V5 561 + 562 + comment "Device tree only" 563 + 564 + config SOC_IMX25 565 + bool "i.MX25 support" 566 + select ARCH_MXC_IOMUX_V3 567 + select CPU_ARM926T 568 + select MXC_AVIC 569 + select PINCTRL_IMX25 570 + help 571 + This enables support for Freescale i.MX25 processor 572 + endif 573 + 497 574 if ARCH_MULTI_V7 498 575 499 576 comment "Device tree only" ··· 588 637 select PL310_ERRATA_769419 if CACHE_L2X0 589 638 590 639 help 591 - This enable support for Freescale Vybrid VF610 processor. 640 + This enables support for Freescale Vybrid VF610 processor. 592 641 593 642 choice 594 643 prompt "Clocksource for scheduler clock" ··· 618 667 select ZONE_DMA if ARM_LPAE 619 668 620 669 help 621 - This enable support for Freescale LS1021A processor. 670 + This enables support for Freescale LS1021A processor. 622 671 623 672 endif 624 673
+1 -7
arch/arm/mach-imx/Makefile
··· 3 3 obj-$(CONFIG_SOC_IMX1) += clk-imx1.o mm-imx1.o 4 4 obj-$(CONFIG_SOC_IMX21) += clk-imx21.o mm-imx21.o 5 5 6 - obj-$(CONFIG_SOC_IMX25) += clk-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o 6 + obj-$(CONFIG_SOC_IMX25) += clk-imx25.o cpu-imx25.o mach-imx25.o 7 7 8 8 obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o 9 9 obj-$(CONFIG_SOC_IMX27) += clk-imx27.o mm-imx27.o ehci-imx27.o ··· 47 47 48 48 # i.MX21 based machines 49 49 obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o 50 - 51 - # i.MX25 based machines 52 - obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25_3ds.o 53 - obj-$(CONFIG_MACH_EUKREA_CPUIMX25SD) += mach-eukrea_cpuimx25.o 54 - obj-$(CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD) += eukrea_mbimxsd25-baseboard.o 55 - obj-$(CONFIG_MACH_IMX25_DT) += imx25-dt.o 56 50 57 51 # i.MX27 based machines 58 52 obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o
-75
arch/arm/mach-imx/clk-imx25.c
··· 30 30 #include "clk.h" 31 31 #include "common.h" 32 32 #include "hardware.h" 33 - #include "mx25.h" 34 33 35 34 #define CCM_MPCTL 0x00 36 35 #define CCM_UPCTL 0x04 ··· 234 235 * is used on some imx25 board designs to clock the audio codec. 235 236 */ 236 237 clk_set_parent(clk[cko_sel], clk[ipg]); 237 - 238 - return 0; 239 - } 240 - 241 - int __init mx25_clocks_init(void) 242 - { 243 - void __iomem *ccm; 244 - 245 - ccm = ioremap(MX25_CRM_BASE_ADDR, SZ_16K); 246 - 247 - __mx25_clocks_init(24000000, ccm); 248 - 249 - clk_register_clkdev(clk[gpt1_ipg], "ipg", "imx-gpt.0"); 250 - clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0"); 251 - /* i.mx25 has the i.mx21 type uart */ 252 - clk_register_clkdev(clk[uart1_ipg], "ipg", "imx21-uart.0"); 253 - clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.0"); 254 - clk_register_clkdev(clk[uart2_ipg], "ipg", "imx21-uart.1"); 255 - clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.1"); 256 - clk_register_clkdev(clk[uart3_ipg], "ipg", "imx21-uart.2"); 257 - clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.2"); 258 - clk_register_clkdev(clk[uart4_ipg], "ipg", "imx21-uart.3"); 259 - clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.3"); 260 - clk_register_clkdev(clk[uart5_ipg], "ipg", "imx21-uart.4"); 261 - clk_register_clkdev(clk[uart_ipg_per], "per", "imx21-uart.4"); 262 - clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.0"); 263 - clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.0"); 264 - clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0"); 265 - clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.1"); 266 - clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.1"); 267 - clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.1"); 268 - clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2"); 269 - clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.2"); 270 - clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2"); 271 - clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27"); 272 - clk_register_clkdev(clk[usbotg_ahb], "ahb", "imx-udc-mx27"); 273 - clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27"); 274 - clk_register_clkdev(clk[nfc_ipg_per], NULL, "imx25-nand.0"); 275 - /* i.mx25 has the i.mx35 type cspi */ 276 - clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0"); 277 - clk_register_clkdev(clk[cspi2_ipg], NULL, "imx35-cspi.1"); 278 - clk_register_clkdev(clk[cspi3_ipg], NULL, "imx35-cspi.2"); 279 - clk_register_clkdev(clk[kpp_ipg], NULL, "imx-keypad"); 280 - clk_register_clkdev(clk[tsc_ipg], NULL, "mx25-adc"); 281 - clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.0"); 282 - clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.1"); 283 - clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.2"); 284 - clk_register_clkdev(clk[fec_ipg], "ipg", "imx25-fec.0"); 285 - clk_register_clkdev(clk[fec_ahb], "ahb", "imx25-fec.0"); 286 - clk_register_clkdev(clk[dryice_ipg], NULL, "imxdi_rtc.0"); 287 - clk_register_clkdev(clk[lcdc_ipg_per], "per", "imx21-fb.0"); 288 - clk_register_clkdev(clk[lcdc_ipg], "ipg", "imx21-fb.0"); 289 - clk_register_clkdev(clk[lcdc_ahb], "ahb", "imx21-fb.0"); 290 - clk_register_clkdev(clk[wdt_ipg], NULL, "imx2-wdt.0"); 291 - clk_register_clkdev(clk[ssi1_ipg], NULL, "imx-ssi.0"); 292 - clk_register_clkdev(clk[ssi2_ipg], NULL, "imx-ssi.1"); 293 - clk_register_clkdev(clk[esdhc1_ipg_per], "per", "sdhci-esdhc-imx25.0"); 294 - clk_register_clkdev(clk[esdhc1_ipg], "ipg", "sdhci-esdhc-imx25.0"); 295 - clk_register_clkdev(clk[esdhc1_ahb], "ahb", "sdhci-esdhc-imx25.0"); 296 - clk_register_clkdev(clk[esdhc2_ipg_per], "per", "sdhci-esdhc-imx25.1"); 297 - clk_register_clkdev(clk[esdhc2_ipg], "ipg", "sdhci-esdhc-imx25.1"); 298 - clk_register_clkdev(clk[esdhc2_ahb], "ahb", "sdhci-esdhc-imx25.1"); 299 - clk_register_clkdev(clk[csi_ipg_per], "per", "imx25-camera.0"); 300 - clk_register_clkdev(clk[csi_ipg], "ipg", "imx25-camera.0"); 301 - clk_register_clkdev(clk[csi_ahb], "ahb", "imx25-camera.0"); 302 - clk_register_clkdev(clk[dummy], "audmux", NULL); 303 - clk_register_clkdev(clk[can1_ipg], NULL, "flexcan.0"); 304 - clk_register_clkdev(clk[can2_ipg], NULL, "flexcan.1"); 305 - /* i.mx25 has the i.mx35 type sdma */ 306 - clk_register_clkdev(clk[sdma_ipg], "ipg", "imx35-sdma"); 307 - clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma"); 308 - clk_register_clkdev(clk[iim_ipg], "iim", NULL); 309 - 310 - mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), MX25_INT_GPT1); 311 238 312 239 return 0; 313 240 }
-5
arch/arm/mach-imx/common.h
··· 23 23 24 24 void mx1_map_io(void); 25 25 void mx21_map_io(void); 26 - void mx25_map_io(void); 27 26 void mx27_map_io(void); 28 27 void mx31_map_io(void); 29 28 void mx35_map_io(void); 30 29 void imx1_init_early(void); 31 30 void imx21_init_early(void); 32 - void imx25_init_early(void); 33 31 void imx27_init_early(void); 34 32 void imx31_init_early(void); 35 33 void imx35_init_early(void); ··· 35 37 void tzic_init_irq(void); 36 38 void mx1_init_irq(void); 37 39 void mx21_init_irq(void); 38 - void mx25_init_irq(void); 39 40 void mx27_init_irq(void); 40 41 void mx31_init_irq(void); 41 42 void mx35_init_irq(void); 42 43 void imx1_soc_init(void); 43 44 void imx21_soc_init(void); 44 - void imx25_soc_init(void); 45 45 void imx27_soc_init(void); 46 46 void imx31_soc_init(void); 47 47 void imx35_soc_init(void); ··· 47 51 void mxc_timer_init(void __iomem *, int); 48 52 int mx1_clocks_init(unsigned long fref); 49 53 int mx21_clocks_init(unsigned long lref, unsigned long fref); 50 - int mx25_clocks_init(void); 51 54 int mx27_clocks_init(unsigned long fref); 52 55 int mx31_clocks_init(unsigned long fref); 53 56 int mx35_clocks_init(void);
+10 -1
arch/arm/mach-imx/cpu-imx25.c
··· 11 11 */ 12 12 #include <linux/module.h> 13 13 #include <linux/io.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 14 16 15 17 #include "iim.h" 16 18 #include "hardware.h" ··· 22 20 static int mx25_read_cpu_rev(void) 23 21 { 24 22 u32 rev; 23 + void __iomem *iim_base; 24 + struct device_node *np; 25 25 26 - rev = __raw_readl(MX25_IO_ADDRESS(MX25_IIM_BASE_ADDR + MXC_IIMSREV)); 26 + np = of_find_compatible_node(NULL, NULL, "fsl,imx25-iim"); 27 + iim_base = of_iomap(np, 0); 28 + BUG_ON(!iim_base); 29 + rev = readl(iim_base + MXC_IIMSREV); 30 + iounmap(iim_base); 31 + 27 32 switch (rev) { 28 33 case 0x00: 29 34 return IMX_CHIP_REVISION_1_0;
-85
arch/arm/mach-imx/devices-imx25.h
··· 1 - /* 2 - * Copyright (C) 2010 Pengutronix 3 - * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> 4 - * 5 - * This program is free software; you can redistribute it and/or modify it under 6 - * the terms of the GNU General Public License version 2 as published by the 7 - * Free Software Foundation. 8 - */ 9 - #include "devices/devices-common.h" 10 - 11 - extern const struct imx_fec_data imx25_fec_data; 12 - #define imx25_add_fec(pdata) \ 13 - imx_add_fec(&imx25_fec_data, pdata) 14 - 15 - extern const struct imx_flexcan_data imx25_flexcan_data[]; 16 - #define imx25_add_flexcan(id) \ 17 - imx_add_flexcan(&imx25_flexcan_data[id]) 18 - #define imx25_add_flexcan0() imx25_add_flexcan(0) 19 - #define imx25_add_flexcan1() imx25_add_flexcan(1) 20 - 21 - extern const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data; 22 - #define imx25_add_fsl_usb2_udc(pdata) \ 23 - imx_add_fsl_usb2_udc(&imx25_fsl_usb2_udc_data, pdata) 24 - 25 - extern struct imx_imxdi_rtc_data imx25_imxdi_rtc_data; 26 - #define imx25_add_imxdi_rtc() \ 27 - imx_add_imxdi_rtc(&imx25_imxdi_rtc_data) 28 - 29 - extern const struct imx_imx2_wdt_data imx25_imx2_wdt_data; 30 - #define imx25_add_imx2_wdt() \ 31 - imx_add_imx2_wdt(&imx25_imx2_wdt_data) 32 - 33 - extern const struct imx_imx_fb_data imx25_imx_fb_data; 34 - #define imx25_add_imx_fb(pdata) \ 35 - imx_add_imx_fb(&imx25_imx_fb_data, pdata) 36 - 37 - extern const struct imx_imx_i2c_data imx25_imx_i2c_data[]; 38 - #define imx25_add_imx_i2c(id, pdata) \ 39 - imx_add_imx_i2c(&imx25_imx_i2c_data[id], pdata) 40 - #define imx25_add_imx_i2c0(pdata) imx25_add_imx_i2c(0, pdata) 41 - #define imx25_add_imx_i2c1(pdata) imx25_add_imx_i2c(1, pdata) 42 - #define imx25_add_imx_i2c2(pdata) imx25_add_imx_i2c(2, pdata) 43 - 44 - extern const struct imx_imx_keypad_data imx25_imx_keypad_data; 45 - #define imx25_add_imx_keypad(pdata) \ 46 - imx_add_imx_keypad(&imx25_imx_keypad_data, pdata) 47 - 48 - extern const struct imx_imx_ssi_data imx25_imx_ssi_data[]; 49 - #define imx25_add_imx_ssi(id, pdata) \ 50 - imx_add_imx_ssi(&imx25_imx_ssi_data[id], pdata) 51 - 52 - extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[]; 53 - #define imx25_add_imx_uart(id, pdata) \ 54 - imx_add_imx_uart_1irq(&imx25_imx_uart_data[id], pdata) 55 - #define imx25_add_imx_uart0(pdata) imx25_add_imx_uart(0, pdata) 56 - #define imx25_add_imx_uart1(pdata) imx25_add_imx_uart(1, pdata) 57 - #define imx25_add_imx_uart2(pdata) imx25_add_imx_uart(2, pdata) 58 - #define imx25_add_imx_uart3(pdata) imx25_add_imx_uart(3, pdata) 59 - #define imx25_add_imx_uart4(pdata) imx25_add_imx_uart(4, pdata) 60 - 61 - extern const struct imx_mx2_camera_data imx25_mx2_camera_data; 62 - #define imx25_add_mx2_camera(pdata) \ 63 - imx_add_mx2_camera(&imx25_mx2_camera_data, pdata) 64 - 65 - extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data; 66 - #define imx25_add_mxc_ehci_otg(pdata) \ 67 - imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata) 68 - extern const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data; 69 - #define imx25_add_mxc_ehci_hs(pdata) \ 70 - imx_add_mxc_ehci(&imx25_mxc_ehci_hs_data, pdata) 71 - 72 - extern const struct imx_mxc_nand_data imx25_mxc_nand_data; 73 - #define imx25_add_mxc_nand(pdata) \ 74 - imx_add_mxc_nand(&imx25_mxc_nand_data, pdata) 75 - 76 - extern const struct imx_sdhci_esdhc_imx_data imx25_sdhci_esdhc_imx_data[]; 77 - #define imx25_add_sdhci_esdhc_imx(id, pdata) \ 78 - imx_add_sdhci_esdhc_imx(&imx25_sdhci_esdhc_imx_data[id], pdata) 79 - 80 - extern const struct imx_spi_imx_data imx25_cspi_data[]; 81 - #define imx25_add_spi_imx(id, pdata) \ 82 - imx_add_spi_imx(&imx25_cspi_data[id], pdata) 83 - #define imx25_add_spi_imx0(pdata) imx25_add_spi_imx(0, pdata) 84 - #define imx25_add_spi_imx1(pdata) imx25_add_spi_imx(1, pdata) 85 - #define imx25_add_spi_imx2(pdata) imx25_add_spi_imx(2, pdata)
-3
arch/arm/mach-imx/devices/Kconfig
··· 21 21 config IMX_HAVE_PLATFORM_IMX2_WDT 22 22 bool 23 23 24 - config IMX_HAVE_PLATFORM_IMXDI_RTC 25 - bool 26 - 27 24 config IMX_HAVE_PLATFORM_IMX_FB 28 25 bool 29 26
-1
arch/arm/mach-imx/devices/Makefile
··· 8 8 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o 9 9 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX27_CODA) += platform-imx27-coda.o 10 10 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o 11 - obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o 12 11 obj-y += platform-imx-dma.o 13 12 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o 14 13 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
-5
arch/arm/mach-imx/devices/platform-fec.c
··· 19 19 .irq = soc ## _INT_FEC, \ 20 20 } 21 21 22 - #ifdef CONFIG_SOC_IMX25 23 - const struct imx_fec_data imx25_fec_data __initconst = 24 - imx_fec_data_entry_single(MX25, "imx25-fec"); 25 - #endif /* ifdef CONFIG_SOC_IMX25 */ 26 - 27 22 #ifdef CONFIG_SOC_IMX27 28 23 const struct imx_fec_data imx27_fec_data __initconst = 29 24 imx_fec_data_entry_single(MX27, "imx27-fec");
-5
arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
··· 18 18 .irq = soc ## _INT_USB_OTG, \ 19 19 } 20 20 21 - #ifdef CONFIG_SOC_IMX25 22 - const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = 23 - imx_fsl_usb2_udc_data_entry_single(MX25, "imx-udc-mx27"); 24 - #endif /* ifdef CONFIG_SOC_IMX25 */ 25 - 26 21 #ifdef CONFIG_SOC_IMX27 27 22 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = 28 23 imx_fsl_usb2_udc_data_entry_single(MX27, "imx-udc-mx27");
-5
arch/arm/mach-imx/devices/platform-imx-fb.c
··· 29 29 imx_imx_fb_data_entry_single(MX21, "imx21-fb", SZ_4K); 30 30 #endif /* ifdef CONFIG_SOC_IMX21 */ 31 31 32 - #ifdef CONFIG_SOC_IMX25 33 - const struct imx_imx_fb_data imx25_imx_fb_data __initconst = 34 - imx_imx_fb_data_entry_single(MX25, "imx21-fb", SZ_16K); 35 - #endif /* ifdef CONFIG_SOC_IMX25 */ 36 - 37 32 #ifdef CONFIG_SOC_IMX27 38 33 const struct imx_imx_fb_data imx27_imx_fb_data __initconst = 39 34 imx_imx_fb_data_entry_single(MX27, "imx21-fb", SZ_4K);
-10
arch/arm/mach-imx/devices/platform-imx-i2c.c
··· 31 31 imx_imx_i2c_data_entry_single(MX21, "imx21-i2c", 0, , SZ_4K); 32 32 #endif /* ifdef CONFIG_SOC_IMX21 */ 33 33 34 - #ifdef CONFIG_SOC_IMX25 35 - const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = { 36 - #define imx25_imx_i2c_data_entry(_id, _hwid) \ 37 - imx_imx_i2c_data_entry(MX25, "imx21-i2c", _id, _hwid, SZ_16K) 38 - imx25_imx_i2c_data_entry(0, 1), 39 - imx25_imx_i2c_data_entry(1, 2), 40 - imx25_imx_i2c_data_entry(2, 3), 41 - }; 42 - #endif /* ifdef CONFIG_SOC_IMX25 */ 43 - 44 34 #ifdef CONFIG_SOC_IMX27 45 35 const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = { 46 36 #define imx27_imx_i2c_data_entry(_id, _hwid) \
-5
arch/arm/mach-imx/devices/platform-imx-keypad.c
··· 21 21 imx_imx_keypad_data_entry_single(MX21, SZ_16); 22 22 #endif /* ifdef CONFIG_SOC_IMX21 */ 23 23 24 - #ifdef CONFIG_SOC_IMX25 25 - const struct imx_imx_keypad_data imx25_imx_keypad_data __initconst = 26 - imx_imx_keypad_data_entry_single(MX25, SZ_16K); 27 - #endif /* ifdef CONFIG_SOC_IMX25 */ 28 - 29 24 #ifdef CONFIG_SOC_IMX27 30 25 const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst = 31 26 imx_imx_keypad_data_entry_single(MX27, SZ_16);
-9
arch/arm/mach-imx/devices/platform-imx-ssi.c
··· 30 30 }; 31 31 #endif /* ifdef CONFIG_SOC_IMX21 */ 32 32 33 - #ifdef CONFIG_SOC_IMX25 34 - const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst = { 35 - #define imx25_imx_ssi_data_entry(_id, _hwid) \ 36 - imx_imx_ssi_data_entry(MX25, _id, _hwid, SZ_4K) 37 - imx25_imx_ssi_data_entry(0, 1), 38 - imx25_imx_ssi_data_entry(1, 2), 39 - }; 40 - #endif /* ifdef CONFIG_SOC_IMX25 */ 41 - 42 33 #ifdef CONFIG_SOC_IMX27 43 34 const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = { 44 35 #define imx27_imx_ssi_data_entry(_id, _hwid) \
-12
arch/arm/mach-imx/devices/platform-imx-uart.c
··· 47 47 }; 48 48 #endif 49 49 50 - #ifdef CONFIG_SOC_IMX25 51 - const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst = { 52 - #define imx25_imx_uart_data_entry(_id, _hwid) \ 53 - imx_imx_uart_1irq_data_entry(MX25, _id, _hwid, SZ_16K) 54 - imx25_imx_uart_data_entry(0, 1), 55 - imx25_imx_uart_data_entry(1, 2), 56 - imx25_imx_uart_data_entry(2, 3), 57 - imx25_imx_uart_data_entry(3, 4), 58 - imx25_imx_uart_data_entry(4, 5), 59 - }; 60 - #endif /* ifdef CONFIG_SOC_IMX25 */ 61 - 62 50 #ifdef CONFIG_SOC_IMX27 63 51 const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst = { 64 52 #define imx27_imx_uart_data_entry(_id, _hwid) \
-5
arch/arm/mach-imx/devices/platform-imx2-wdt.c
··· 25 25 imx_imx2_wdt_data_entry_single(MX21, 0, , SZ_4K); 26 26 #endif /* ifdef CONFIG_SOC_IMX21 */ 27 27 28 - #ifdef CONFIG_SOC_IMX25 29 - const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst = 30 - imx_imx2_wdt_data_entry_single(MX25, 0, , SZ_16K); 31 - #endif /* ifdef CONFIG_SOC_IMX25 */ 32 - 33 28 #ifdef CONFIG_SOC_IMX27 34 29 const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst = 35 30 imx_imx2_wdt_data_entry_single(MX27, 0, , SZ_4K);
-42
arch/arm/mach-imx/devices/platform-imxdi_rtc.c
··· 1 - /* 2 - * Copyright (C) 2010 Pengutronix 3 - * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> 4 - * 5 - * This program is free software; you can redistribute it and/or modify it under 6 - * the terms of the GNU General Public License version 2 as published by the 7 - * Free Software Foundation. 8 - */ 9 - #include <asm/sizes.h> 10 - 11 - #include "../hardware.h" 12 - #include "devices-common.h" 13 - 14 - #define imx_imxdi_rtc_data_entry_single(soc) \ 15 - { \ 16 - .iobase = soc ## _DRYICE_BASE_ADDR, \ 17 - .irq = soc ## _INT_DRYICE, \ 18 - } 19 - 20 - #ifdef CONFIG_SOC_IMX25 21 - const struct imx_imxdi_rtc_data imx25_imxdi_rtc_data __initconst = 22 - imx_imxdi_rtc_data_entry_single(MX25); 23 - #endif /* ifdef CONFIG_SOC_IMX25 */ 24 - 25 - struct platform_device *__init imx_add_imxdi_rtc( 26 - const struct imx_imxdi_rtc_data *data) 27 - { 28 - struct resource res[] = { 29 - { 30 - .start = data->iobase, 31 - .end = data->iobase + SZ_16K - 1, 32 - .flags = IORESOURCE_MEM, 33 - }, { 34 - .start = data->irq, 35 - .end = data->irq, 36 - .flags = IORESOURCE_IRQ, 37 - }, 38 - }; 39 - 40 - return imx_add_platform_device("imxdi_rtc", 0, 41 - res, ARRAY_SIZE(res), NULL, 0); 42 - }
-5
arch/arm/mach-imx/devices/platform-mx2-camera.c
··· 27 27 .irqemmaprp = soc ## _INT_EMMAPRP, \ 28 28 } 29 29 30 - #ifdef CONFIG_SOC_IMX25 31 - const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst = 32 - imx_mx2_camera_data_entry_single(MX25, "imx25-camera"); 33 - #endif /* ifdef CONFIG_SOC_IMX25 */ 34 - 35 30 #ifdef CONFIG_SOC_IMX27 36 31 const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst = 37 32 imx_mx2_camera_data_entry_single_emma(MX27, "imx27-camera");
-7
arch/arm/mach-imx/devices/platform-mxc-ehci.c
··· 18 18 .irq = soc ## _INT_USB_ ## hs, \ 19 19 } 20 20 21 - #ifdef CONFIG_SOC_IMX25 22 - const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst = 23 - imx_mxc_ehci_data_entry_single(MX25, 0, OTG); 24 - const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst = 25 - imx_mxc_ehci_data_entry_single(MX25, 1, HS); 26 - #endif /* ifdef CONFIG_SOC_IMX25 */ 27 - 28 21 #ifdef CONFIG_SOC_IMX27 29 22 const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst = 30 23 imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
-5
arch/arm/mach-imx/devices/platform-mxc_nand.c
··· 34 34 imx_mxc_nand_data_entry_single(MX21, "imx21-nand", SZ_4K); 35 35 #endif /* ifdef CONFIG_SOC_IMX21 */ 36 36 37 - #ifdef CONFIG_SOC_IMX25 38 - const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst = 39 - imx_mxc_nand_data_entry_single(MX25, "imx25-nand", SZ_8K); 40 - #endif /* ifdef CONFIG_SOC_IMX25 */ 41 - 42 37 #ifdef CONFIG_SOC_IMX27 43 38 const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst = 44 39 imx_mxc_nand_data_entry_single(MX27, "imx27-nand", SZ_4K);
-11
arch/arm/mach-imx/devices/platform-spi_imx.c
··· 39 39 }; 40 40 #endif 41 41 42 - #ifdef CONFIG_SOC_IMX25 43 - /* i.mx25 has the i.mx35 type cspi */ 44 - const struct imx_spi_imx_data imx25_cspi_data[] __initconst = { 45 - #define imx25_cspi_data_entry(_id, _hwid) \ 46 - imx_spi_imx_data_entry(MX25, CSPI, "imx35-cspi", _id, _hwid, SZ_16K) 47 - imx25_cspi_data_entry(0, 1), 48 - imx25_cspi_data_entry(1, 2), 49 - imx25_cspi_data_entry(2, 3), 50 - }; 51 - #endif /* ifdef CONFIG_SOC_IMX25 */ 52 - 53 42 #ifdef CONFIG_SOC_IMX27 54 43 const struct imx_spi_imx_data imx27_cspi_data[] __initconst = { 55 44 #define imx27_cspi_data_entry(_id, _hwid) \
-99
arch/arm/mach-imx/ehci-imx25.c
··· 1 - /* 2 - * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de> 3 - * Copyright (C) 2010 Freescale Semiconductor, Inc. 4 - * 5 - * This program is free software; you can redistribute it and/or modify it 6 - * under the terms of the GNU General Public License as published by the 7 - * Free Software Foundation; either version 2 of the License, or (at your 8 - * option) any later version. 9 - * 10 - * This program is distributed in the hope that it will be useful, but 11 - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 - * for more details. 14 - */ 15 - 16 - #include <linux/platform_device.h> 17 - #include <linux/io.h> 18 - #include <linux/platform_data/usb-ehci-mxc.h> 19 - 20 - #include "ehci.h" 21 - #include "hardware.h" 22 - 23 - #define USBCTRL_OTGBASE_OFFSET 0x600 24 - 25 - #define MX25_OTG_SIC_SHIFT 29 26 - #define MX25_OTG_SIC_MASK (0x3 << MX25_OTG_SIC_SHIFT) 27 - #define MX25_OTG_PM_BIT (1 << 24) 28 - #define MX25_OTG_PP_BIT (1 << 11) 29 - #define MX25_OTG_OCPOL_BIT (1 << 3) 30 - 31 - #define MX25_H1_SIC_SHIFT 21 32 - #define MX25_H1_SIC_MASK (0x3 << MX25_H1_SIC_SHIFT) 33 - #define MX25_H1_PP_BIT (1 << 18) 34 - #define MX25_H1_PM_BIT (1 << 16) 35 - #define MX25_H1_IPPUE_UP_BIT (1 << 7) 36 - #define MX25_H1_IPPUE_DOWN_BIT (1 << 6) 37 - #define MX25_H1_TLL_BIT (1 << 5) 38 - #define MX25_H1_USBTE_BIT (1 << 4) 39 - #define MX25_H1_OCPOL_BIT (1 << 2) 40 - 41 - int mx25_initialize_usb_hw(int port, unsigned int flags) 42 - { 43 - unsigned int v; 44 - 45 - v = readl(MX25_IO_ADDRESS(MX25_USB_BASE_ADDR + USBCTRL_OTGBASE_OFFSET)); 46 - 47 - switch (port) { 48 - case 0: /* OTG port */ 49 - v &= ~(MX25_OTG_SIC_MASK | MX25_OTG_PM_BIT | MX25_OTG_PP_BIT | 50 - MX25_OTG_OCPOL_BIT); 51 - v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX25_OTG_SIC_SHIFT; 52 - 53 - if (!(flags & MXC_EHCI_POWER_PINS_ENABLED)) 54 - v |= MX25_OTG_PM_BIT; 55 - 56 - if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) 57 - v |= MX25_OTG_PP_BIT; 58 - 59 - if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)) 60 - v |= MX25_OTG_OCPOL_BIT; 61 - 62 - break; 63 - case 1: /* H1 port */ 64 - v &= ~(MX25_H1_SIC_MASK | MX25_H1_PM_BIT | MX25_H1_PP_BIT | 65 - MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT | MX25_H1_USBTE_BIT | 66 - MX25_H1_IPPUE_DOWN_BIT | MX25_H1_IPPUE_UP_BIT); 67 - v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX25_H1_SIC_SHIFT; 68 - 69 - if (!(flags & MXC_EHCI_POWER_PINS_ENABLED)) 70 - v |= MX25_H1_PM_BIT; 71 - 72 - if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) 73 - v |= MX25_H1_PP_BIT; 74 - 75 - if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)) 76 - v |= MX25_H1_OCPOL_BIT; 77 - 78 - if (!(flags & MXC_EHCI_TTL_ENABLED)) 79 - v |= MX25_H1_TLL_BIT; 80 - 81 - if (flags & MXC_EHCI_INTERNAL_PHY) 82 - v |= MX25_H1_USBTE_BIT; 83 - 84 - if (flags & MXC_EHCI_IPPUE_DOWN) 85 - v |= MX25_H1_IPPUE_DOWN_BIT; 86 - 87 - if (flags & MXC_EHCI_IPPUE_UP) 88 - v |= MX25_H1_IPPUE_UP_BIT; 89 - 90 - break; 91 - default: 92 - return -EINVAL; 93 - } 94 - 95 - writel(v, MX25_IO_ADDRESS(MX25_USB_BASE_ADDR + USBCTRL_OTGBASE_OFFSET)); 96 - 97 - return 0; 98 - } 99 -
-310
arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
··· 1 - /* 2 - * Copyright (C) 2010 Eric Benard - eric@eukrea.com 3 - * 4 - * Based on pcm970-baseboard.c which is : 5 - * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) 6 - * 7 - * This program is free software; you can redistribute it and/or 8 - * modify it under the terms of the GNU General Public License 9 - * as published by the Free Software Foundation; either version 2 10 - * of the License, or (at your option) any later version. 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 - * MA 02110-1301, USA. 20 - */ 21 - 22 - #include <linux/gpio.h> 23 - #include <linux/leds.h> 24 - #include <linux/platform_device.h> 25 - #include <linux/input.h> 26 - #include <linux/spi/spi.h> 27 - #include <video/platform_lcd.h> 28 - 29 - #include <asm/mach-types.h> 30 - #include <asm/mach/arch.h> 31 - 32 - #include "common.h" 33 - #include "devices-imx25.h" 34 - #include "hardware.h" 35 - #include "iomux-mx25.h" 36 - #include "mx25.h" 37 - 38 - static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { 39 - /* LCD */ 40 - MX25_PAD_LD0__LD0, 41 - MX25_PAD_LD1__LD1, 42 - MX25_PAD_LD2__LD2, 43 - MX25_PAD_LD3__LD3, 44 - MX25_PAD_LD4__LD4, 45 - MX25_PAD_LD5__LD5, 46 - MX25_PAD_LD6__LD6, 47 - MX25_PAD_LD7__LD7, 48 - MX25_PAD_LD8__LD8, 49 - MX25_PAD_LD9__LD9, 50 - MX25_PAD_LD10__LD10, 51 - MX25_PAD_LD11__LD11, 52 - MX25_PAD_LD12__LD12, 53 - MX25_PAD_LD13__LD13, 54 - MX25_PAD_LD14__LD14, 55 - MX25_PAD_LD15__LD15, 56 - MX25_PAD_GPIO_E__LD16, 57 - MX25_PAD_GPIO_F__LD17, 58 - MX25_PAD_HSYNC__HSYNC, 59 - MX25_PAD_VSYNC__VSYNC, 60 - MX25_PAD_LSCLK__LSCLK, 61 - MX25_PAD_OE_ACD__OE_ACD, 62 - MX25_PAD_CONTRAST__CONTRAST, 63 - /* LCD_PWR */ 64 - MX25_PAD_PWM__GPIO_1_26, 65 - /* LED */ 66 - MX25_PAD_POWER_FAIL__GPIO_3_19, 67 - /* SWITCH */ 68 - MX25_PAD_VSTBY_ACK__GPIO_3_18, 69 - /* UART2 */ 70 - MX25_PAD_UART2_RTS__UART2_RTS, 71 - MX25_PAD_UART2_CTS__UART2_CTS, 72 - MX25_PAD_UART2_TXD__UART2_TXD, 73 - MX25_PAD_UART2_RXD__UART2_RXD, 74 - /* SD1 */ 75 - MX25_PAD_SD1_CMD__SD1_CMD, 76 - MX25_PAD_SD1_CLK__SD1_CLK, 77 - MX25_PAD_SD1_DATA0__SD1_DATA0, 78 - MX25_PAD_SD1_DATA1__SD1_DATA1, 79 - MX25_PAD_SD1_DATA2__SD1_DATA2, 80 - MX25_PAD_SD1_DATA3__SD1_DATA3, 81 - /* SD1 CD */ 82 - MX25_PAD_DE_B__GPIO_2_20, 83 - /* I2S */ 84 - MX25_PAD_KPP_COL3__AUD5_TXFS, 85 - MX25_PAD_KPP_COL2__AUD5_TXC, 86 - MX25_PAD_KPP_COL1__AUD5_RXD, 87 - MX25_PAD_KPP_COL0__AUD5_TXD, 88 - /* CAN */ 89 - MX25_PAD_GPIO_D__CAN2_RX, 90 - MX25_PAD_GPIO_C__CAN2_TX, 91 - /* SPI1 */ 92 - MX25_PAD_CSPI1_MOSI__CSPI1_MOSI, 93 - MX25_PAD_CSPI1_MISO__CSPI1_MISO, 94 - MX25_PAD_CSPI1_SS0__GPIO_1_16, 95 - MX25_PAD_CSPI1_SS1__GPIO_1_17, 96 - MX25_PAD_CSPI1_SCLK__CSPI1_SCLK, 97 - MX25_PAD_CSPI1_RDY__GPIO_2_22, 98 - }; 99 - 100 - #define GPIO_LED1 IMX_GPIO_NR(3, 19) 101 - #define GPIO_SWITCH1 IMX_GPIO_NR(3, 18) 102 - #define GPIO_SD1CD IMX_GPIO_NR(2, 20) 103 - #define GPIO_LCDPWR IMX_GPIO_NR(1, 26) 104 - #define GPIO_SPI1_SS0 IMX_GPIO_NR(1, 16) 105 - #define GPIO_SPI1_SS1 IMX_GPIO_NR(1, 17) 106 - #define GPIO_SPI1_IRQ IMX_GPIO_NR(2, 22) 107 - 108 - static struct imx_fb_videomode eukrea_mximxsd_modes[] = { 109 - { 110 - .mode = { 111 - .name = "CMO-QVGA", 112 - .refresh = 60, 113 - .xres = 320, 114 - .yres = 240, 115 - .pixclock = KHZ2PICOS(6500), 116 - .left_margin = 30, 117 - .right_margin = 38, 118 - .upper_margin = 20, 119 - .lower_margin = 3, 120 - .hsync_len = 15, 121 - .vsync_len = 4, 122 - }, 123 - .bpp = 16, 124 - .pcr = 0xCAD08B80, 125 - }, { 126 - .mode = { 127 - .name = "DVI-VGA", 128 - .refresh = 60, 129 - .xres = 640, 130 - .yres = 480, 131 - .pixclock = 32000, 132 - .hsync_len = 7, 133 - .left_margin = 100, 134 - .right_margin = 100, 135 - .vsync_len = 7, 136 - .upper_margin = 7, 137 - .lower_margin = 100, 138 - }, 139 - .pcr = 0xFA208B80, 140 - .bpp = 16, 141 - }, { 142 - .mode = { 143 - .name = "DVI-SVGA", 144 - .refresh = 60, 145 - .xres = 800, 146 - .yres = 600, 147 - .pixclock = 25000, 148 - .hsync_len = 7, 149 - .left_margin = 75, 150 - .right_margin = 75, 151 - .vsync_len = 7, 152 - .upper_margin = 7, 153 - .lower_margin = 75, 154 - }, 155 - .pcr = 0xFA208B80, 156 - .bpp = 16, 157 - }, 158 - }; 159 - 160 - static const struct imx_fb_platform_data eukrea_mximxsd_fb_pdata __initconst = { 161 - .mode = eukrea_mximxsd_modes, 162 - .num_modes = ARRAY_SIZE(eukrea_mximxsd_modes), 163 - .pwmr = 0x00A903FF, 164 - .lscr1 = 0x00120300, 165 - .dmacr = 0x00040060, 166 - }; 167 - 168 - static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd, 169 - unsigned int power) 170 - { 171 - if (power) 172 - gpio_direction_output(GPIO_LCDPWR, 1); 173 - else 174 - gpio_direction_output(GPIO_LCDPWR, 0); 175 - } 176 - 177 - static struct plat_lcd_data eukrea_mbimxsd_lcd_power_data = { 178 - .set_power = eukrea_mbimxsd_lcd_power_set, 179 - }; 180 - 181 - static struct platform_device eukrea_mbimxsd_lcd_powerdev = { 182 - .name = "platform-lcd", 183 - .dev.platform_data = &eukrea_mbimxsd_lcd_power_data, 184 - }; 185 - 186 - static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = { 187 - { 188 - .name = "led1", 189 - .default_trigger = "heartbeat", 190 - .active_low = 1, 191 - .gpio = GPIO_LED1, 192 - }, 193 - }; 194 - 195 - static const struct gpio_led_platform_data 196 - eukrea_mbimxsd_led_info __initconst = { 197 - .leds = eukrea_mbimxsd_leds, 198 - .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds), 199 - }; 200 - 201 - static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = { 202 - { 203 - .gpio = GPIO_SWITCH1, 204 - .code = BTN_0, 205 - .desc = "BP1", 206 - .active_low = 1, 207 - .wakeup = 1, 208 - }, 209 - }; 210 - 211 - static const struct gpio_keys_platform_data 212 - eukrea_mbimxsd_button_data __initconst = { 213 - .buttons = eukrea_mbimxsd_gpio_buttons, 214 - .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons), 215 - }; 216 - 217 - static struct platform_device *platform_devices[] __initdata = { 218 - &eukrea_mbimxsd_lcd_powerdev, 219 - }; 220 - 221 - static const struct imxuart_platform_data uart_pdata __initconst = { 222 - .flags = IMXUART_HAVE_RTSCTS, 223 - }; 224 - 225 - static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = { 226 - { 227 - I2C_BOARD_INFO("tlv320aic23", 0x1a), 228 - }, 229 - }; 230 - 231 - static const 232 - struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = { 233 - .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE, 234 - }; 235 - 236 - static struct esdhc_platform_data sd1_pdata = { 237 - .cd_gpio = GPIO_SD1CD, 238 - .cd_type = ESDHC_CD_GPIO, 239 - .wp_type = ESDHC_WP_NONE, 240 - }; 241 - 242 - static struct spi_board_info eukrea_mbimxsd25_spi_board_info[] __initdata = { 243 - { 244 - .modalias = "spidev", 245 - .max_speed_hz = 20000000, 246 - .bus_num = 0, 247 - .chip_select = 0, 248 - .mode = SPI_MODE_0, 249 - }, 250 - { 251 - .modalias = "spidev", 252 - .max_speed_hz = 20000000, 253 - .bus_num = 0, 254 - .chip_select = 1, 255 - .mode = SPI_MODE_0, 256 - }, 257 - }; 258 - 259 - static int eukrea_mbimxsd25_spi_cs[] = {GPIO_SPI1_SS0, GPIO_SPI1_SS1}; 260 - 261 - static const struct spi_imx_master eukrea_mbimxsd25_spi0_data __initconst = { 262 - .chipselect = eukrea_mbimxsd25_spi_cs, 263 - .num_chipselect = ARRAY_SIZE(eukrea_mbimxsd25_spi_cs), 264 - }; 265 - 266 - /* 267 - * system init for baseboard usage. Will be called by cpuimx25 init. 268 - * 269 - * Add platform devices present on this baseboard and init 270 - * them from CPU side as far as required to use them later on 271 - */ 272 - void __init eukrea_mbimxsd25_baseboard_init(void) 273 - { 274 - if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads, 275 - ARRAY_SIZE(eukrea_mbimxsd_pads))) 276 - printk(KERN_ERR "error setting mbimxsd pads !\n"); 277 - 278 - imx25_add_imx_uart1(&uart_pdata); 279 - imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata); 280 - imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); 281 - 282 - imx25_add_flexcan1(); 283 - imx25_add_sdhci_esdhc_imx(0, &sd1_pdata); 284 - 285 - gpio_request(GPIO_LED1, "LED1"); 286 - gpio_direction_output(GPIO_LED1, 1); 287 - gpio_free(GPIO_LED1); 288 - 289 - gpio_request(GPIO_SWITCH1, "SWITCH1"); 290 - gpio_direction_input(GPIO_SWITCH1); 291 - gpio_free(GPIO_SWITCH1); 292 - 293 - gpio_request(GPIO_LCDPWR, "LCDPWR"); 294 - gpio_direction_output(GPIO_LCDPWR, 1); 295 - 296 - i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, 297 - ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); 298 - 299 - gpio_request(GPIO_SPI1_IRQ, "SPI1_IRQ"); 300 - gpio_direction_input(GPIO_SPI1_IRQ); 301 - gpio_free(GPIO_SPI1_IRQ); 302 - imx25_add_spi_imx0(&eukrea_mbimxsd25_spi0_data); 303 - spi_register_board_info(eukrea_mbimxsd25_spi_board_info, 304 - ARRAY_SIZE(eukrea_mbimxsd25_spi_board_info)); 305 - 306 - platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 307 - gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); 308 - imx_add_gpio_keys(&eukrea_mbimxsd_button_data); 309 - imx_add_platform_device("eukrea_tlv320", 0, NULL, 0, NULL, 0); 310 - }
+1 -1
arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
··· 100 100 .num_modes = ARRAY_SIZE(fb_modedb), 101 101 }; 102 102 103 - static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { 103 + static const iomux_v3_cfg_t eukrea_mbimxsd_pads[] __initconst = { 104 104 /* LCD */ 105 105 MX35_PAD_LD0__IPU_DISPB_DAT_0, 106 106 MX35_PAD_LD1__IPU_DISPB_DAT_1,
-1
arch/arm/mach-imx/hardware.h
··· 112 112 #include "mx21.h" 113 113 #include "mx27.h" 114 114 #include "mx1.h" 115 - #include "mx25.h" 116 115 117 116 #define imx_map_entry(soc, name, _type) { \ 118 117 .virtual = soc ## _IO_P2V(soc ## _ ## name ## _BASE_ADDR), \
+18 -2
arch/arm/mach-imx/imx25-dt.c arch/arm/mach-imx/mach-imx25.c
··· 10 10 */ 11 11 12 12 #include <linux/irq.h> 13 + #include <linux/of_address.h> 13 14 #include <linux/of_irq.h> 14 15 #include <linux/of_platform.h> 15 16 #include <asm/mach/arch.h> 16 17 #include <asm/mach/time.h> 17 18 #include "common.h" 18 - #include "mx25.h" 19 + #include "hardware.h" 20 + 21 + static void __init imx25_init_early(void) 22 + { 23 + mxc_set_cpu_type(MXC_CPU_MX25); 24 + } 25 + 26 + static void __init mx25_init_irq(void) 27 + { 28 + struct device_node *np; 29 + void __iomem *avic_base; 30 + 31 + np = of_find_compatible_node(NULL, NULL, "fsl,avic"); 32 + avic_base = of_iomap(np, 0); 33 + BUG_ON(!avic_base); 34 + mxc_init_irq(avic_base); 35 + } 19 36 20 37 static const char * const imx25_dt_board_compat[] __initconst = { 21 38 "fsl,imx25", ··· 40 23 }; 41 24 42 25 DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") 43 - .map_io = mx25_map_io, 44 26 .init_early = imx25_init_early, 45 27 .init_irq = mx25_init_irq, 46 28 .dt_compat = imx25_dt_board_compat,
-524
arch/arm/mach-imx/iomux-mx25.h
··· 1 - /* 2 - * arch/arm/plat-mxc/include/mach/iomux-mx25.h 3 - * 4 - * Copyright (C) 2009 by Lothar Wassmann <LW@KARO-electronics.de> 5 - * 6 - * based on arch/arm/mach-mx25/mx25_pins.h 7 - * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. 8 - * and 9 - * arch/arm/plat-mxc/include/mach/iomux-mx35.h 10 - * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH <armlinux@phytec.de> 11 - * 12 - * The code contained herein is licensed under the GNU General Public 13 - * License. You may obtain a copy of the GNU General Public License 14 - * Version 2 or later at the following locations: 15 - * 16 - * http://www.opensource.org/licenses/gpl-license.html 17 - * http://www.gnu.org/copyleft/gpl.html 18 - */ 19 - #ifndef __MACH_IOMUX_MX25_H__ 20 - #define __MACH_IOMUX_MX25_H__ 21 - 22 - #include "iomux-v3.h" 23 - 24 - /* 25 - * IOMUX/PAD Bit field definitions 26 - */ 27 - 28 - #define MX25_PAD_A10__A10 IOMUX_PAD(0x000, 0x008, 0x00, 0, 0, NO_PAD_CTRL) 29 - #define MX25_PAD_A10__GPIO_4_0 IOMUX_PAD(0x000, 0x008, 0x05, 0, 0, NO_PAD_CTRL) 30 - 31 - #define MX25_PAD_A13__A13 IOMUX_PAD(0x22C, 0x00c, 0x00, 0, 0, NO_PAD_CTRL) 32 - #define MX25_PAD_A13__GPIO_4_1 IOMUX_PAD(0x22C, 0x00c, 0x05, 0, 0, NO_PAD_CTRL) 33 - 34 - #define MX25_PAD_A14__A14 IOMUX_PAD(0x230, 0x010, 0x10, 0, 0, NO_PAD_CTRL) 35 - #define MX25_PAD_A14__GPIO_2_0 IOMUX_PAD(0x230, 0x010, 0x15, 0, 0, NO_PAD_CTRL) 36 - 37 - #define MX25_PAD_A15__A15 IOMUX_PAD(0x234, 0x014, 0x10, 0, 0, NO_PAD_CTRL) 38 - #define MX25_PAD_A15__GPIO_2_1 IOMUX_PAD(0x234, 0x014, 0x15, 0, 0, NO_PAD_CTRL) 39 - 40 - #define MX25_PAD_A16__A16 IOMUX_PAD(0x000, 0x018, 0x10, 0, 0, NO_PAD_CTRL) 41 - #define MX25_PAD_A16__GPIO_2_2 IOMUX_PAD(0x000, 0x018, 0x15, 0, 0, NO_PAD_CTRL) 42 - 43 - #define MX25_PAD_A17__A17 IOMUX_PAD(0x238, 0x01c, 0x10, 0, 0, NO_PAD_CTRL) 44 - #define MX25_PAD_A17__GPIO_2_3 IOMUX_PAD(0x238, 0x01c, 0x15, 0, 0, NO_PAD_CTRL) 45 - 46 - #define MX25_PAD_A18__A18 IOMUX_PAD(0x23c, 0x020, 0x10, 0, 0, NO_PAD_CTRL) 47 - #define MX25_PAD_A18__GPIO_2_4 IOMUX_PAD(0x23c, 0x020, 0x15, 0, 0, NO_PAD_CTRL) 48 - #define MX25_PAD_A18__FEC_COL IOMUX_PAD(0x23c, 0x020, 0x17, 0x504, 0, NO_PAD_CTRL) 49 - 50 - #define MX25_PAD_A19__A19 IOMUX_PAD(0x240, 0x024, 0x10, 0, 0, NO_PAD_CTRL) 51 - #define MX25_PAD_A19__FEC_RX_ER IOMUX_PAD(0x240, 0x024, 0x17, 0x518, 0, NO_PAD_CTRL) 52 - #define MX25_PAD_A19__GPIO_2_5 IOMUX_PAD(0x240, 0x024, 0x15, 0, 0, NO_PAD_CTRL) 53 - 54 - #define MX25_PAD_A20__A20 IOMUX_PAD(0x244, 0x028, 0x10, 0, 0, NO_PAD_CTRL) 55 - #define MX25_PAD_A20__GPIO_2_6 IOMUX_PAD(0x244, 0x028, 0x15, 0, 0, NO_PAD_CTRL) 56 - #define MX25_PAD_A20__FEC_RDATA2 IOMUX_PAD(0x244, 0x028, 0x17, 0x50c, 0, NO_PAD_CTRL) 57 - 58 - #define MX25_PAD_A21__A21 IOMUX_PAD(0x248, 0x02c, 0x10, 0, 0, NO_PAD_CTRL) 59 - #define MX25_PAD_A21__GPIO_2_7 IOMUX_PAD(0x248, 0x02c, 0x15, 0, 0, NO_PAD_CTRL) 60 - #define MX25_PAD_A21__FEC_RDATA3 IOMUX_PAD(0x248, 0x02c, 0x17, 0x510, 0, NO_PAD_CTRL) 61 - 62 - #define MX25_PAD_A22__A22 IOMUX_PAD(0x000, 0x030, 0x10, 0, 0, NO_PAD_CTRL) 63 - #define MX25_PAD_A22__GPIO_2_8 IOMUX_PAD(0x000, 0x030, 0x15, 0, 0, NO_PAD_CTRL) 64 - 65 - #define MX25_PAD_A23__A23 IOMUX_PAD(0x24c, 0x034, 0x10, 0, 0, NO_PAD_CTRL) 66 - #define MX25_PAD_A23__GPIO_2_9 IOMUX_PAD(0x24c, 0x034, 0x15, 0, 0, NO_PAD_CTRL) 67 - 68 - #define MX25_PAD_A24__A24 IOMUX_PAD(0x250, 0x038, 0x10, 0, 0, NO_PAD_CTRL) 69 - #define MX25_PAD_A24__GPIO_2_10 IOMUX_PAD(0x250, 0x038, 0x15, 0, 0, NO_PAD_CTRL) 70 - #define MX25_PAD_A24__FEC_RX_CLK IOMUX_PAD(0x250, 0x038, 0x17, 0x514, 0, NO_PAD_CTRL) 71 - 72 - #define MX25_PAD_A25__A25 IOMUX_PAD(0x254, 0x03c, 0x10, 0, 0, NO_PAD_CTRL) 73 - #define MX25_PAD_A25__GPIO_2_11 IOMUX_PAD(0x254, 0x03c, 0x15, 0, 0, NO_PAD_CTRL) 74 - #define MX25_PAD_A25__FEC_CRS IOMUX_PAD(0x254, 0x03c, 0x17, 0x508, 0, NO_PAD_CTRL) 75 - 76 - #define MX25_PAD_EB0__EB0 IOMUX_PAD(0x258, 0x040, 0x10, 0, 0, NO_PAD_CTRL) 77 - #define MX25_PAD_EB0__AUD4_TXD IOMUX_PAD(0x258, 0x040, 0x14, 0x464, 0, NO_PAD_CTRL) 78 - #define MX25_PAD_EB0__GPIO_2_12 IOMUX_PAD(0x258, 0x040, 0x15, 0, 0, NO_PAD_CTRL) 79 - 80 - #define MX25_PAD_EB1__EB1 IOMUX_PAD(0x25c, 0x044, 0x10, 0, 0, NO_PAD_CTRL) 81 - #define MX25_PAD_EB1__AUD4_RXD IOMUX_PAD(0x25c, 0x044, 0x14, 0x460, 0, NO_PAD_CTRL) 82 - #define MX25_PAD_EB1__GPIO_2_13 IOMUX_PAD(0x25c, 0x044, 0x15, 0, 0, NO_PAD_CTRL) 83 - 84 - #define MX25_PAD_OE__OE IOMUX_PAD(0x260, 0x048, 0x10, 0, 0, NO_PAD_CTRL) 85 - #define MX25_PAD_OE__AUD4_TXC IOMUX_PAD(0x260, 0x048, 0x14, 0, 0, NO_PAD_CTRL) 86 - #define MX25_PAD_OE__GPIO_2_14 IOMUX_PAD(0x260, 0x048, 0x15, 0, 0, NO_PAD_CTRL) 87 - 88 - #define MX25_PAD_CS0__CS0 IOMUX_PAD(0x000, 0x04c, 0x00, 0, 0, NO_PAD_CTRL) 89 - #define MX25_PAD_CS0__GPIO_4_2 IOMUX_PAD(0x000, 0x04c, 0x05, 0, 0, NO_PAD_CTRL) 90 - 91 - #define MX25_PAD_CS1__CS1 IOMUX_PAD(0x000, 0x050, 0x00, 0, 0, NO_PAD_CTRL) 92 - #define MX25_PAD_CS1__NF_CE3 IOMUX_PAD(0x000, 0x050, 0x01, 0, 0, NO_PAD_CTRL) 93 - #define MX25_PAD_CS1__GPIO_4_3 IOMUX_PAD(0x000, 0x050, 0x05, 0, 0, NO_PAD_CTRL) 94 - 95 - #define MX25_PAD_CS4__CS4 IOMUX_PAD(0x264, 0x054, 0x10, 0, 0, NO_PAD_CTRL) 96 - #define MX25_PAD_CS4__NF_CE1 IOMUX_PAD(0x264, 0x054, 0x01, 0, 0, NO_PAD_CTRL) 97 - #define MX25_PAD_CS4__UART5_CTS IOMUX_PAD(0x264, 0x054, 0x13, 0, 0, NO_PAD_CTRL) 98 - #define MX25_PAD_CS4__GPIO_3_20 IOMUX_PAD(0x264, 0x054, 0x15, 0, 0, NO_PAD_CTRL) 99 - 100 - #define MX25_PAD_CS5__CS5 IOMUX_PAD(0x268, 0x058, 0x10, 0, 0, NO_PAD_CTRL) 101 - #define MX25_PAD_CS5__NF_CE2 IOMUX_PAD(0x268, 0x058, 0x01, 0, 0, NO_PAD_CTRL) 102 - #define MX25_PAD_CS5__UART5_RTS IOMUX_PAD(0x268, 0x058, 0x13, 0x574, 0, NO_PAD_CTRL) 103 - #define MX25_PAD_CS5__GPIO_3_21 IOMUX_PAD(0x268, 0x058, 0x15, 0, 0, NO_PAD_CTRL) 104 - 105 - #define MX25_PAD_NF_CE0__NF_CE0 IOMUX_PAD(0x26c, 0x05c, 0x10, 0, 0, NO_PAD_CTRL) 106 - #define MX25_PAD_NF_CE0__GPIO_3_22 IOMUX_PAD(0x26c, 0x05c, 0x15, 0, 0, NO_PAD_CTRL) 107 - 108 - #define MX25_PAD_ECB__ECB IOMUX_PAD(0x270, 0x060, 0x10, 0, 0, NO_PAD_CTRL) 109 - #define MX25_PAD_ECB__UART5_TXD_MUX IOMUX_PAD(0x270, 0x060, 0x13, 0, 0, NO_PAD_CTRL) 110 - #define MX25_PAD_ECB__GPIO_3_23 IOMUX_PAD(0x270, 0x060, 0x15, 0, 0, NO_PAD_CTRL) 111 - 112 - #define MX25_PAD_LBA__LBA IOMUX_PAD(0x274, 0x064, 0x10, 0, 0, NO_PAD_CTRL) 113 - #define MX25_PAD_LBA__UART5_RXD_MUX IOMUX_PAD(0x274, 0x064, 0x13, 0x578, 0, NO_PAD_CTRL) 114 - #define MX25_PAD_LBA__GPIO_3_24 IOMUX_PAD(0x274, 0x064, 0x15, 0, 0, NO_PAD_CTRL) 115 - 116 - #define MX25_PAD_BCLK__BCLK IOMUX_PAD(0x000, 0x068, 0x00, 0, 0, NO_PAD_CTRL) 117 - #define MX25_PAD_BCLK__GPIO_4_4 IOMUX_PAD(0x000, 0x068, 0x05, 0, 0, NO_PAD_CTRL) 118 - 119 - #define MX25_PAD_RW__RW IOMUX_PAD(0x278, 0x06c, 0x10, 0, 0, NO_PAD_CTRL) 120 - #define MX25_PAD_RW__AUD4_TXFS IOMUX_PAD(0x278, 0x06c, 0x14, 0x474, 0, NO_PAD_CTRL) 121 - #define MX25_PAD_RW__GPIO_3_25 IOMUX_PAD(0x278, 0x06c, 0x15, 0, 0, NO_PAD_CTRL) 122 - 123 - #define MX25_PAD_NFWE_B__NFWE_B IOMUX_PAD(0x000, 0x070, 0x10, 0, 0, NO_PAD_CTRL) 124 - #define MX25_PAD_NFWE_B__GPIO_3_26 IOMUX_PAD(0x000, 0x070, 0x15, 0, 0, NO_PAD_CTRL) 125 - 126 - #define MX25_PAD_NFRE_B__NFRE_B IOMUX_PAD(0x000, 0x074, 0x10, 0, 0, NO_PAD_CTRL) 127 - #define MX25_PAD_NFRE_B__GPIO_3_27 IOMUX_PAD(0x000, 0x074, 0x15, 0, 0, NO_PAD_CTRL) 128 - 129 - #define MX25_PAD_NFALE__NFALE IOMUX_PAD(0x000, 0x078, 0x10, 0, 0, NO_PAD_CTRL) 130 - #define MX25_PAD_NFALE__GPIO_3_28 IOMUX_PAD(0x000, 0x078, 0x15, 0, 0, NO_PAD_CTRL) 131 - 132 - #define MX25_PAD_NFCLE__NFCLE IOMUX_PAD(0x000, 0x07c, 0x10, 0, 0, NO_PAD_CTRL) 133 - #define MX25_PAD_NFCLE__GPIO_3_29 IOMUX_PAD(0x000, 0x07c, 0x15, 0, 0, NO_PAD_CTRL) 134 - 135 - #define MX25_PAD_NFWP_B__NFWP_B IOMUX_PAD(0x000, 0x080, 0x10, 0, 0, NO_PAD_CTRL) 136 - #define MX25_PAD_NFWP_B__GPIO_3_30 IOMUX_PAD(0x000, 0x080, 0x15, 0, 0, NO_PAD_CTRL) 137 - 138 - #define MX25_PAD_NFRB__NFRB IOMUX_PAD(0x27c, 0x084, 0x10, 0, 0, PAD_CTL_PKE) 139 - #define MX25_PAD_NFRB__GPIO_3_31 IOMUX_PAD(0x27c, 0x084, 0x15, 0, 0, NO_PAD_CTRL) 140 - 141 - #define MX25_PAD_D15__D15 IOMUX_PAD(0x280, 0x088, 0x00, 0, 0, NO_PAD_CTRL) 142 - #define MX25_PAD_D15__LD16 IOMUX_PAD(0x280, 0x088, 0x01, 0, 0, PAD_CTL_SRE_FAST) 143 - #define MX25_PAD_D15__GPIO_4_5 IOMUX_PAD(0x280, 0x088, 0x05, 0, 0, NO_PAD_CTRL) 144 - 145 - #define MX25_PAD_D14__D14 IOMUX_PAD(0x284, 0x08c, 0x00, 0, 0, NO_PAD_CTRL) 146 - #define MX25_PAD_D14__LD17 IOMUX_PAD(0x284, 0x08c, 0x01, 0, 0, PAD_CTL_SRE_FAST) 147 - #define MX25_PAD_D14__GPIO_4_6 IOMUX_PAD(0x284, 0x08c, 0x05, 0, 0, NO_PAD_CTRL) 148 - 149 - #define MX25_PAD_D13__D13 IOMUX_PAD(0x288, 0x090, 0x00, 0, 0, NO_PAD_CTRL) 150 - #define MX25_PAD_D13__LD18 IOMUX_PAD(0x288, 0x090, 0x01, 0, 0, PAD_CTL_SRE_FAST) 151 - #define MX25_PAD_D13__GPIO_4_7 IOMUX_PAD(0x288, 0x090, 0x05, 0, 0, NO_PAD_CTRL) 152 - 153 - #define MX25_PAD_D12__D12 IOMUX_PAD(0x28c, 0x094, 0x00, 0, 0, NO_PAD_CTRL) 154 - #define MX25_PAD_D12__GPIO_4_8 IOMUX_PAD(0x28c, 0x094, 0x05, 0, 0, NO_PAD_CTRL) 155 - 156 - #define MX25_PAD_D11__D11 IOMUX_PAD(0x290, 0x098, 0x00, 0, 0, NO_PAD_CTRL) 157 - #define MX25_PAD_D11__GPIO_4_9 IOMUX_PAD(0x290, 0x098, 0x05, 0, 0, NO_PAD_CTRL) 158 - 159 - #define MX25_PAD_D10__D10 IOMUX_PAD(0x294, 0x09c, 0x00, 0, 0, NO_PAD_CTRL) 160 - #define MX25_PAD_D10__GPIO_4_10 IOMUX_PAD(0x294, 0x09c, 0x05, 0, 0, NO_PAD_CTRL) 161 - #define MX25_PAD_D10__USBOTG_OC IOMUX_PAD(0x294, 0x09c, 0x06, 0x57c, 0, PAD_CTL_PUS_100K_UP) 162 - 163 - #define MX25_PAD_D9__D9 IOMUX_PAD(0x298, 0x0a0, 0x00, 0, 0, NO_PAD_CTRL) 164 - #define MX25_PAD_D9__GPIO_4_11 IOMUX_PAD(0x298, 0x0a0, 0x05, 0, 0, NO_PAD_CTRL) 165 - #define MX25_PAD_D9__USBH2_PWR IOMUX_PAD(0x298, 0x0a0, 0x06, 0, 0, PAD_CTL_PKE) 166 - 167 - #define MX25_PAD_D8__D8 IOMUX_PAD(0x29c, 0x0a4, 0x00, 0, 0, NO_PAD_CTRL) 168 - #define MX25_PAD_D8__GPIO_4_12 IOMUX_PAD(0x29c, 0x0a4, 0x05, 0, 0, NO_PAD_CTRL) 169 - #define MX25_PAD_D8__USBH2_OC IOMUX_PAD(0x29c, 0x0a4, 0x06, 0x580, 0, PAD_CTL_PUS_100K_UP) 170 - 171 - #define MX25_PAD_D7__D7 IOMUX_PAD(0x2a0, 0x0a8, 0x00, 0, 0, NO_PAD_CTRL) 172 - #define MX25_PAD_D7__GPIO_4_13 IOMUX_PAD(0x2a0, 0x0a8, 0x05, 0, 0, NO_PAD_CTRL) 173 - 174 - #define MX25_PAD_D6__D6 IOMUX_PAD(0x2a4, 0x0ac, 0x00, 0, 0, NO_PAD_CTRL) 175 - #define MX25_PAD_D6__GPIO_4_14 IOMUX_PAD(0x2a4, 0x0ac, 0x05, 0, 0, NO_PAD_CTRL) 176 - 177 - #define MX25_PAD_D5__D5 IOMUX_PAD(0x2a8, 0x0b0, 0x00, 0, 0, NO_PAD_CTRL) 178 - #define MX25_PAD_D5__GPIO_4_15 IOMUX_PAD(0x2a8, 0x0b0, 0x05, 0, 0, NO_PAD_CTRL) 179 - 180 - #define MX25_PAD_D4__D4 IOMUX_PAD(0x2ac, 0x0b4, 0x00, 0, 0, NO_PAD_CTRL) 181 - #define MX25_PAD_D4__GPIO_4_16 IOMUX_PAD(0x2ac, 0x0b4, 0x05, 0, 0, NO_PAD_CTRL) 182 - 183 - #define MX25_PAD_D3__D3 IOMUX_PAD(0x2b0, 0x0b8, 0x00, 0, 0, NO_PAD_CTRL) 184 - #define MX25_PAD_D3__GPIO_4_17 IOMUX_PAD(0x2b0, 0x0b8, 0x05, 0, 0, NO_PAD_CTRL) 185 - 186 - #define MX25_PAD_D2__D2 IOMUX_PAD(0x2b4, 0x0bc, 0x00, 0, 0, NO_PAD_CTRL) 187 - #define MX25_PAD_D2__GPIO_4_18 IOMUX_PAD(0x2b4, 0x0bc, 0x05, 0, 0, NO_PAD_CTRL) 188 - 189 - #define MX25_PAD_D1__D1 IOMUX_PAD(0x2b8, 0x0c0, 0x00, 0, 0, NO_PAD_CTRL) 190 - #define MX25_PAD_D1__GPIO_4_19 IOMUX_PAD(0x2b8, 0x0c0, 0x05, 0, 0, NO_PAD_CTRL) 191 - 192 - #define MX25_PAD_D0__D0 IOMUX_PAD(0x2bc, 0x0c4, 0x00, 0, 0, NO_PAD_CTRL) 193 - #define MX25_PAD_D0__GPIO_4_20 IOMUX_PAD(0x2bc, 0x0c4, 0x05, 0, 0, NO_PAD_CTRL) 194 - 195 - #define MX25_PAD_LD0__LD0 IOMUX_PAD(0x2c0, 0x0c8, 0x10, 0, 0, PAD_CTL_SRE_FAST) 196 - #define MX25_PAD_LD0__CSI_D0 IOMUX_PAD(0x2c0, 0x0c8, 0x12, 0x488, 0, NO_PAD_CTRL) 197 - #define MX25_PAD_LD0__GPIO_2_15 IOMUX_PAD(0x2c0, 0x0c8, 0x15, 0, 0, NO_PAD_CTRL) 198 - 199 - #define MX25_PAD_LD1__LD1 IOMUX_PAD(0x2c4, 0x0cc, 0x10, 0, 0, PAD_CTL_SRE_FAST) 200 - #define MX25_PAD_LD1__CSI_D1 IOMUX_PAD(0x2c4, 0x0cc, 0x12, 0x48c, 0, NO_PAD_CTRL) 201 - #define MX25_PAD_LD1__GPIO_2_16 IOMUX_PAD(0x2c4, 0x0cc, 0x15, 0, 0, NO_PAD_CTRL) 202 - 203 - #define MX25_PAD_LD2__LD2 IOMUX_PAD(0x2c8, 0x0d0, 0x10, 0, 0, PAD_CTL_SRE_FAST) 204 - #define MX25_PAD_LD2__GPIO_2_17 IOMUX_PAD(0x2c8, 0x0d0, 0x15, 0, 0, NO_PAD_CTRL) 205 - 206 - #define MX25_PAD_LD3__LD3 IOMUX_PAD(0x2cc, 0x0d4, 0x10, 0, 0, PAD_CTL_SRE_FAST) 207 - #define MX25_PAD_LD3__GPIO_2_18 IOMUX_PAD(0x2cc, 0x0d4, 0x15, 0, 0, NO_PAD_CTRL) 208 - 209 - #define MX25_PAD_LD4__LD4 IOMUX_PAD(0x2d0, 0x0d8, 0x10, 0, 0, PAD_CTL_SRE_FAST) 210 - #define MX25_PAD_LD4__GPIO_2_19 IOMUX_PAD(0x2d0, 0x0d8, 0x15, 0, 0, NO_PAD_CTRL) 211 - 212 - #define MX25_PAD_LD5__LD5 IOMUX_PAD(0x2d4, 0x0dc, 0x10, 0, 0, PAD_CTL_SRE_FAST) 213 - #define MX25_PAD_LD5__GPIO_1_19 IOMUX_PAD(0x2d4, 0x0dc, 0x15, 0, 0, NO_PAD_CTRL) 214 - 215 - #define MX25_PAD_LD6__LD6 IOMUX_PAD(0x2d8, 0x0e0, 0x10, 0, 0, PAD_CTL_SRE_FAST) 216 - #define MX25_PAD_LD6__GPIO_1_20 IOMUX_PAD(0x2d8, 0x0e0, 0x15, 0, 0, NO_PAD_CTRL) 217 - 218 - #define MX25_PAD_LD7__LD7 IOMUX_PAD(0x2dc, 0x0e4, 0x10, 0, 0, PAD_CTL_SRE_FAST) 219 - #define MX25_PAD_LD7__GPIO_1_21 IOMUX_PAD(0x2dc, 0x0e4, 0x15, 0, 0, NO_PAD_CTRL) 220 - 221 - #define MX25_PAD_LD8__LD8 IOMUX_PAD(0x2e0, 0x0e8, 0x10, 0, 0, PAD_CTL_SRE_FAST) 222 - #define MX25_PAD_LD8__FEC_TX_ERR IOMUX_PAD(0x2e0, 0x0e8, 0x15, 0, 0, NO_PAD_CTRL) 223 - 224 - #define MX25_PAD_LD9__LD9 IOMUX_PAD(0x2e4, 0x0ec, 0x10, 0, 0, PAD_CTL_SRE_FAST) 225 - #define MX25_PAD_LD9__FEC_COL IOMUX_PAD(0x2e4, 0x0ec, 0x15, 0x504, 1, NO_PAD_CTRL) 226 - 227 - #define MX25_PAD_LD10__LD10 IOMUX_PAD(0x2e8, 0x0f0, 0x10, 0, 0, PAD_CTL_SRE_FAST) 228 - #define MX25_PAD_LD10__FEC_RX_ER IOMUX_PAD(0x2e8, 0x0f0, 0x15, 0x518, 1, NO_PAD_CTRL) 229 - 230 - #define MX25_PAD_LD11__LD11 IOMUX_PAD(0x2ec, 0x0f4, 0x10, 0, 0, PAD_CTL_SRE_FAST) 231 - #define MX25_PAD_LD11__FEC_RDATA2 IOMUX_PAD(0x2ec, 0x0f4, 0x15, 0x50c, 1, NO_PAD_CTRL) 232 - 233 - #define MX25_PAD_LD12__LD12 IOMUX_PAD(0x2f0, 0x0f8, 0x10, 0, 0, PAD_CTL_SRE_FAST) 234 - #define MX25_PAD_LD12__FEC_RDATA3 IOMUX_PAD(0x2f0, 0x0f8, 0x15, 0x510, 1, NO_PAD_CTRL) 235 - 236 - #define MX25_PAD_LD13__LD13 IOMUX_PAD(0x2f4, 0x0fc, 0x10, 0, 0, PAD_CTL_SRE_FAST) 237 - #define MX25_PAD_LD13__FEC_TDATA2 IOMUX_PAD(0x2f4, 0x0fc, 0x15, 0, 0, NO_PAD_CTRL) 238 - 239 - #define MX25_PAD_LD14__LD14 IOMUX_PAD(0x2f8, 0x100, 0x10, 0, 0, PAD_CTL_SRE_FAST) 240 - #define MX25_PAD_LD14__FEC_TDATA3 IOMUX_PAD(0x2f8, 0x100, 0x15, 0, 0, NO_PAD_CTRL) 241 - 242 - #define MX25_PAD_LD15__LD15 IOMUX_PAD(0x2fc, 0x104, 0x10, 0, 0, PAD_CTL_SRE_FAST) 243 - #define MX25_PAD_LD15__FEC_RX_CLK IOMUX_PAD(0x2fc, 0x104, 0x15, 0x514, 1, NO_PAD_CTRL) 244 - 245 - #define MX25_PAD_HSYNC__HSYNC IOMUX_PAD(0x300, 0x108, 0x10, 0, 0, NO_PAD_CTRL) 246 - #define MX25_PAD_HSYNC__GPIO_1_22 IOMUX_PAD(0x300, 0x108, 0x15, 0, 0, NO_PAD_CTRL) 247 - 248 - #define MX25_PAD_VSYNC__VSYNC IOMUX_PAD(0x304, 0x10c, 0x10, 0, 0, NO_PAD_CTRL) 249 - #define MX25_PAD_VSYNC__GPIO_1_23 IOMUX_PAD(0x304, 0x10c, 0x15, 0, 0, NO_PAD_CTRL) 250 - 251 - #define MX25_PAD_LSCLK__LSCLK IOMUX_PAD(0x308, 0x110, 0x10, 0, 0, NO_PAD_CTRL) 252 - #define MX25_PAD_LSCLK__GPIO_1_24 IOMUX_PAD(0x308, 0x110, 0x15, 0, 0, NO_PAD_CTRL) 253 - 254 - #define MX25_PAD_OE_ACD__OE_ACD IOMUX_PAD(0x30c, 0x114, 0x10, 0, 0, NO_PAD_CTRL) 255 - #define MX25_PAD_OE_ACD__GPIO_1_25 IOMUX_PAD(0x30c, 0x114, 0x15, 0, 0, NO_PAD_CTRL) 256 - 257 - #define MX25_PAD_CONTRAST__CONTRAST IOMUX_PAD(0x310, 0x118, 0x10, 0, 0, NO_PAD_CTRL) 258 - #define MX25_PAD_CONTRAST__PWM4_PWMO IOMUX_PAD(0x310, 0x118, 0x14, 0, 0, NO_PAD_CTRL) 259 - #define MX25_PAD_CONTRAST__FEC_CRS IOMUX_PAD(0x310, 0x118, 0x15, 0x508, 1, NO_PAD_CTRL) 260 - 261 - #define MX25_PAD_PWM__PWM IOMUX_PAD(0x314, 0x11c, 0x10, 0, 0, NO_PAD_CTRL) 262 - #define MX25_PAD_PWM__GPIO_1_26 IOMUX_PAD(0x314, 0x11c, 0x15, 0, 0, NO_PAD_CTRL) 263 - #define MX25_PAD_PWM__USBH2_OC IOMUX_PAD(0x314, 0x11c, 0x16, 0x580, 1, PAD_CTL_PUS_100K_UP) 264 - 265 - #define MX25_PAD_CSI_D2__CSI_D2 IOMUX_PAD(0x318, 0x120, 0x10, 0, 0, NO_PAD_CTRL) 266 - #define MX25_PAD_CSI_D2__UART5_RXD_MUX IOMUX_PAD(0x318, 0x120, 0x11, 0x578, 1, NO_PAD_CTRL) 267 - #define MX25_PAD_CSI_D2__GPIO_1_27 IOMUX_PAD(0x318, 0x120, 0x15, 0, 0, NO_PAD_CTRL) 268 - #define MX25_PAD_CSI_D2__CSPI3_MOSI IOMUX_PAD(0x318, 0x120, 0x17, 0, 0, NO_PAD_CTRL) 269 - 270 - #define MX25_PAD_CSI_D3__CSI_D3 IOMUX_PAD(0x31c, 0x124, 0x10, 0, 0, NO_PAD_CTRL) 271 - #define MX25_PAD_CSI_D3__GPIO_1_28 IOMUX_PAD(0x31c, 0x124, 0x15, 0, 0, NO_PAD_CTRL) 272 - #define MX25_PAD_CSI_D3__CSPI3_MISO IOMUX_PAD(0x31c, 0x124, 0x17, 0x4b4, 1, NO_PAD_CTRL) 273 - 274 - #define MX25_PAD_CSI_D4__CSI_D4 IOMUX_PAD(0x320, 0x128, 0x10, 0, 0, NO_PAD_CTRL) 275 - #define MX25_PAD_CSI_D4__UART5_RTS IOMUX_PAD(0x320, 0x128, 0x11, 0x574, 1, NO_PAD_CTRL) 276 - #define MX25_PAD_CSI_D4__GPIO_1_29 IOMUX_PAD(0x320, 0x128, 0x15, 0, 0, NO_PAD_CTRL) 277 - #define MX25_PAD_CSI_D4__CSPI3_SCLK IOMUX_PAD(0x320, 0x128, 0x17, 0, 0, NO_PAD_CTRL) 278 - 279 - #define MX25_PAD_CSI_D5__CSI_D5 IOMUX_PAD(0x324, 0x12c, 0x10, 0, 0, NO_PAD_CTRL) 280 - #define MX25_PAD_CSI_D5__GPIO_1_30 IOMUX_PAD(0x324, 0x12c, 0x15, 0, 0, NO_PAD_CTRL) 281 - #define MX25_PAD_CSI_D5__CSPI3_RDY IOMUX_PAD(0x324, 0x12c, 0x17, 0, 0, NO_PAD_CTRL) 282 - 283 - #define MX25_PAD_CSI_D6__CSI_D6 IOMUX_PAD(0x328, 0x130, 0x10, 0, 0, NO_PAD_CTRL) 284 - #define MX25_PAD_CSI_D6__GPIO_1_31 IOMUX_PAD(0x328, 0x130, 0x15, 0, 0, NO_PAD_CTRL) 285 - 286 - #define MX25_PAD_CSI_D7__CSI_D7 IOMUX_PAD(0x32c, 0x134, 0x10, 0, 0, NO_PAD_CTRL) 287 - #define MX25_PAD_CSI_D7__GPIO_1_6 IOMUX_PAD(0x32c, 0x134, 0x15, 0, 0, NO_PAD_CTRL) 288 - 289 - #define MX25_PAD_CSI_D8__CSI_D8 IOMUX_PAD(0x330, 0x138, 0x10, 0, 0, NO_PAD_CTRL) 290 - #define MX25_PAD_CSI_D8__GPIO_1_7 IOMUX_PAD(0x330, 0x138, 0x15, 0, 0, NO_PAD_CTRL) 291 - 292 - #define MX25_PAD_CSI_D9__CSI_D9 IOMUX_PAD(0x334, 0x13c, 0x10, 0, 0, NO_PAD_CTRL) 293 - #define MX25_PAD_CSI_D9__GPIO_4_21 IOMUX_PAD(0x334, 0x13c, 0x15, 0, 0, NO_PAD_CTRL) 294 - 295 - #define MX25_PAD_CSI_MCLK__CSI_MCLK IOMUX_PAD(0x338, 0x140, 0x10, 0, 0, NO_PAD_CTRL) 296 - #define MX25_PAD_CSI_MCLK__GPIO_1_8 IOMUX_PAD(0x338, 0x140, 0x15, 0, 0, NO_PAD_CTRL) 297 - 298 - #define MX25_PAD_CSI_VSYNC__CSI_VSYNC IOMUX_PAD(0x33c, 0x144, 0x10, 0, 0, NO_PAD_CTRL) 299 - #define MX25_PAD_CSI_VSYNC__GPIO_1_9 IOMUX_PAD(0x33c, 0x144, 0x15, 0, 0, NO_PAD_CTRL) 300 - 301 - #define MX25_PAD_CSI_HSYNC__CSI_HSYNC IOMUX_PAD(0x340, 0x148, 0x10, 0, 0, NO_PAD_CTRL) 302 - #define MX25_PAD_CSI_HSYNC__GPIO_1_10 IOMUX_PAD(0x340, 0x148, 0x15, 0, 0, NO_PAD_CTRL) 303 - 304 - #define MX25_PAD_CSI_PIXCLK__CSI_PIXCLK IOMUX_PAD(0x344, 0x14c, 0x10, 0, 0, NO_PAD_CTRL) 305 - #define MX25_PAD_CSI_PIXCLK__GPIO_1_11 IOMUX_PAD(0x344, 0x14c, 0x15, 0, 0, NO_PAD_CTRL) 306 - 307 - #define MX25_PAD_I2C1_CLK__I2C1_CLK IOMUX_PAD(0x348, 0x150, 0x10, 0, 0, NO_PAD_CTRL) 308 - #define MX25_PAD_I2C1_CLK__GPIO_1_12 IOMUX_PAD(0x348, 0x150, 0x15, 0, 0, NO_PAD_CTRL) 309 - 310 - #define MX25_PAD_I2C1_DAT__I2C1_DAT IOMUX_PAD(0x34c, 0x154, 0x10, 0, 0, NO_PAD_CTRL) 311 - #define MX25_PAD_I2C1_DAT__GPIO_1_13 IOMUX_PAD(0x34c, 0x154, 0x15, 0, 0, NO_PAD_CTRL) 312 - 313 - #define MX25_PAD_CSPI1_MOSI__CSPI1_MOSI IOMUX_PAD(0x350, 0x158, 0x10, 0, 0, NO_PAD_CTRL) 314 - #define MX25_PAD_CSPI1_MOSI__GPIO_1_14 IOMUX_PAD(0x350, 0x158, 0x15, 0, 0, NO_PAD_CTRL) 315 - 316 - #define MX25_PAD_CSPI1_MISO__CSPI1_MISO IOMUX_PAD(0x354, 0x15c, 0x10, 0, 0, NO_PAD_CTRL) 317 - #define MX25_PAD_CSPI1_MISO__GPIO_1_15 IOMUX_PAD(0x354, 0x15c, 0x15, 0, 0, NO_PAD_CTRL) 318 - 319 - #define MX25_PAD_CSPI1_SS0__CSPI1_SS0 IOMUX_PAD(0x358, 0x160, 0x10, 0, 0, NO_PAD_CTRL) 320 - #define MX25_PAD_CSPI1_SS0__GPIO_1_16 IOMUX_PAD(0x358, 0x160, 0x15, 0, 0, NO_PAD_CTRL) 321 - 322 - #define MX25_PAD_CSPI1_SS1__CSPI1_SS1 IOMUX_PAD(0x35c, 0x164, 0x10, 0, 0, NO_PAD_CTRL) 323 - #define MX25_PAD_CSPI1_SS1__GPIO_1_17 IOMUX_PAD(0x35c, 0x164, 0x15, 0, 0, NO_PAD_CTRL) 324 - 325 - #define MX25_PAD_CSPI1_SCLK__CSPI1_SCLK IOMUX_PAD(0x360, 0x168, 0x10, 0, 0, NO_PAD_CTRL) 326 - #define MX25_PAD_CSPI1_SCLK__GPIO_1_18 IOMUX_PAD(0x360, 0x168, 0x15, 0, 0, NO_PAD_CTRL) 327 - 328 - #define MX25_PAD_CSPI1_RDY__CSPI1_RDY IOMUX_PAD(0x364, 0x16c, 0x10, 0, 0, PAD_CTL_PKE) 329 - #define MX25_PAD_CSPI1_RDY__GPIO_2_22 IOMUX_PAD(0x364, 0x16c, 0x15, 0, 0, NO_PAD_CTRL) 330 - 331 - #define MX25_PAD_UART1_RXD__UART1_RXD IOMUX_PAD(0x368, 0x170, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN) 332 - #define MX25_PAD_UART1_RXD__GPIO_4_22 IOMUX_PAD(0x368, 0x170, 0x15, 0, 0, NO_PAD_CTRL) 333 - 334 - #define MX25_PAD_UART1_TXD__UART1_TXD IOMUX_PAD(0x36c, 0x174, 0x10, 0, 0, NO_PAD_CTRL) 335 - #define MX25_PAD_UART1_TXD__GPIO_4_23 IOMUX_PAD(0x36c, 0x174, 0x15, 0, 0, NO_PAD_CTRL) 336 - 337 - #define MX25_PAD_UART1_RTS__UART1_RTS IOMUX_PAD(0x370, 0x178, 0x10, 0, 0, PAD_CTL_PUS_100K_UP) 338 - #define MX25_PAD_UART1_RTS__CSI_D0 IOMUX_PAD(0x370, 0x178, 0x11, 0x488, 1, NO_PAD_CTRL) 339 - #define MX25_PAD_UART1_RTS__GPIO_4_24 IOMUX_PAD(0x370, 0x178, 0x15, 0, 0, NO_PAD_CTRL) 340 - 341 - #define MX25_PAD_UART1_CTS__UART1_CTS IOMUX_PAD(0x374, 0x17c, 0x10, 0, 0, PAD_CTL_PUS_100K_UP) 342 - #define MX25_PAD_UART1_CTS__CSI_D1 IOMUX_PAD(0x374, 0x17c, 0x11, 0x48c, 1, NO_PAD_CTRL) 343 - #define MX25_PAD_UART1_CTS__GPIO_4_25 IOMUX_PAD(0x374, 0x17c, 0x15, 0, 0, NO_PAD_CTRL) 344 - 345 - #define MX25_PAD_UART2_RXD__UART2_RXD IOMUX_PAD(0x378, 0x180, 0x10, 0, 0, NO_PAD_CTRL) 346 - #define MX25_PAD_UART2_RXD__GPIO_4_26 IOMUX_PAD(0x378, 0x180, 0x15, 0, 0, NO_PAD_CTRL) 347 - 348 - #define MX25_PAD_UART2_TXD__UART2_TXD IOMUX_PAD(0x37c, 0x184, 0x10, 0, 0, NO_PAD_CTRL) 349 - #define MX25_PAD_UART2_TXD__GPIO_4_27 IOMUX_PAD(0x37c, 0x184, 0x15, 0, 0, NO_PAD_CTRL) 350 - 351 - #define MX25_PAD_UART2_RTS__UART2_RTS IOMUX_PAD(0x380, 0x188, 0x10, 0, 0, NO_PAD_CTRL) 352 - #define MX25_PAD_UART2_RTS__FEC_COL IOMUX_PAD(0x380, 0x188, 0x12, 0x504, 2, NO_PAD_CTRL) 353 - #define MX25_PAD_UART2_RTS__GPIO_4_28 IOMUX_PAD(0x380, 0x188, 0x15, 0, 0, NO_PAD_CTRL) 354 - 355 - #define MX25_PAD_UART2_CTS__FEC_RX_ER IOMUX_PAD(0x384, 0x18c, 0x12, 0x518, 2, NO_PAD_CTRL) 356 - #define MX25_PAD_UART2_CTS__UART2_CTS IOMUX_PAD(0x384, 0x18c, 0x10, 0, 0, NO_PAD_CTRL) 357 - #define MX25_PAD_UART2_CTS__GPIO_4_29 IOMUX_PAD(0x384, 0x18c, 0x15, 0, 0, NO_PAD_CTRL) 358 - 359 - #define MX25_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x388, 0x190, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 360 - #define MX25_PAD_SD1_CMD__FEC_RDATA2 IOMUX_PAD(0x388, 0x190, 0x12, 0x50c, 2, NO_PAD_CTRL) 361 - #define MX25_PAD_SD1_CMD__GPIO_2_23 IOMUX_PAD(0x388, 0x190, 0x15, 0, 0, NO_PAD_CTRL) 362 - 363 - #define MX25_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x38c, 0x194, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 364 - #define MX25_PAD_SD1_CLK__FEC_RDATA3 IOMUX_PAD(0x38c, 0x194, 0x12, 0x510, 2, NO_PAD_CTRL) 365 - #define MX25_PAD_SD1_CLK__GPIO_2_24 IOMUX_PAD(0x38c, 0x194, 0x15, 0, 0, NO_PAD_CTRL) 366 - 367 - #define MX25_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x390, 0x198, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 368 - #define MX25_PAD_SD1_DATA0__GPIO_2_25 IOMUX_PAD(0x390, 0x198, 0x15, 0, 0, NO_PAD_CTRL) 369 - 370 - #define MX25_PAD_SD1_DATA1__SD1_DATA1 IOMUX_PAD(0x394, 0x19c, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 371 - #define MX25_PAD_SD1_DATA1__AUD7_RXD IOMUX_PAD(0x394, 0x19c, 0x13, 0x478, 0, NO_PAD_CTRL) 372 - #define MX25_PAD_SD1_DATA1__GPIO_2_26 IOMUX_PAD(0x394, 0x19c, 0x15, 0, 0, NO_PAD_CTRL) 373 - 374 - #define MX25_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x398, 0x1a0, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 375 - #define MX25_PAD_SD1_DATA2__FEC_RX_CLK IOMUX_PAD(0x398, 0x1a0, 0x15, 0x514, 2, NO_PAD_CTRL) 376 - #define MX25_PAD_SD1_DATA2__GPIO_2_27 IOMUX_PAD(0x398, 0x1a0, 0x15, 0, 0, NO_PAD_CTRL) 377 - 378 - #define MX25_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x39c, 0x1a4, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 379 - #define MX25_PAD_SD1_DATA3__FEC_CRS IOMUX_PAD(0x39c, 0x1a4, 0x10, 0x508, 2, NO_PAD_CTRL) 380 - #define MX25_PAD_SD1_DATA3__GPIO_2_28 IOMUX_PAD(0x39c, 0x1a4, 0x15, 0, 0, NO_PAD_CTRL) 381 - 382 - #define KPP_CTL_ROW (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_100K_UP) 383 - #define KPP_CTL_COL (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_100K_UP | PAD_CTL_ODE) 384 - 385 - #define MX25_PAD_KPP_ROW0__KPP_ROW0 IOMUX_PAD(0x3a0, 0x1a8, 0x10, 0, 0, KPP_CTL_ROW) 386 - #define MX25_PAD_KPP_ROW0__GPIO_2_29 IOMUX_PAD(0x3a0, 0x1a8, 0x15, 0, 0, NO_PAD_CTRL) 387 - 388 - #define MX25_PAD_KPP_ROW1__KPP_ROW1 IOMUX_PAD(0x3a4, 0x1ac, 0x10, 0, 0, KPP_CTL_ROW) 389 - #define MX25_PAD_KPP_ROW1__GPIO_2_30 IOMUX_PAD(0x3a4, 0x1ac, 0x15, 0, 0, NO_PAD_CTRL) 390 - 391 - #define MX25_PAD_KPP_ROW2__KPP_ROW2 IOMUX_PAD(0x3a8, 0x1b0, 0x10, 0, 0, KPP_CTL_ROW) 392 - #define MX25_PAD_KPP_ROW2__CSI_D0 IOMUX_PAD(0x3a8, 0x1b0, 0x13, 0x488, 2, NO_PAD_CTRL) 393 - #define MX25_PAD_KPP_ROW2__GPIO_2_31 IOMUX_PAD(0x3a8, 0x1b0, 0x15, 0, 0, NO_PAD_CTRL) 394 - 395 - #define MX25_PAD_KPP_ROW3__KPP_ROW3 IOMUX_PAD(0x3ac, 0x1b4, 0x10, 0, 0, KPP_CTL_ROW) 396 - #define MX25_PAD_KPP_ROW3__CSI_LD1 IOMUX_PAD(0x3ac, 0x1b4, 0x13, 0x48c, 2, NO_PAD_CTRL) 397 - #define MX25_PAD_KPP_ROW3__GPIO_3_0 IOMUX_PAD(0x3ac, 0x1b4, 0x15, 0, 0, NO_PAD_CTRL) 398 - 399 - #define MX25_PAD_KPP_COL0__KPP_COL0 IOMUX_PAD(0x3b0, 0x1b8, 0x10, 0, 0, KPP_CTL_COL) 400 - #define MX25_PAD_KPP_COL0__UART4_RXD_MUX IOMUX_PAD(0x3b0, 0x1b8, 0x11, 0x570, 1, NO_PAD_CTRL) 401 - #define MX25_PAD_KPP_COL0__AUD5_TXD IOMUX_PAD(0x3b0, 0x1b8, 0x12, 0, 0, PAD_CTL_PKE | PAD_CTL_PUS_100K_UP) 402 - #define MX25_PAD_KPP_COL0__GPIO_3_1 IOMUX_PAD(0x3b0, 0x1b8, 0x15, 0, 0, NO_PAD_CTRL) 403 - 404 - #define MX25_PAD_KPP_COL1__KPP_COL1 IOMUX_PAD(0x3b4, 0x1bc, 0x10, 0, 0, KPP_CTL_COL) 405 - #define MX25_PAD_KPP_COL1__UART4_TXD_MUX IOMUX_PAD(0x3b4, 0x1bc, 0x11, 0, 0, NO_PAD_CTRL) 406 - #define MX25_PAD_KPP_COL1__AUD5_RXD IOMUX_PAD(0x3b4, 0x1bc, 0x12, 0, 0, PAD_CTL_PKE | PAD_CTL_PUS_100K_UP) 407 - #define MX25_PAD_KPP_COL1__GPIO_3_2 IOMUX_PAD(0x3b4, 0x1bc, 0x15, 0, 0, NO_PAD_CTRL) 408 - 409 - #define MX25_PAD_KPP_COL2__KPP_COL2 IOMUX_PAD(0x3b8, 0x1c0, 0x10, 0, 0, KPP_CTL_COL) 410 - #define MX25_PAD_KPP_COL2__UART4_RTS IOMUX_PAD(0x3b8, 0x1c0, 0x11, 0, 0, NO_PAD_CTRL) 411 - #define MX25_PAD_KPP_COL2__AUD5_TXC IOMUX_PAD(0x3b8, 0x1c0, 0x12, 0, 0, PAD_CTL_PKE | PAD_CTL_PUS_100K_UP) 412 - #define MX25_PAD_KPP_COL2__GPIO_3_3 IOMUX_PAD(0x3b8, 0x1c0, 0x15, 0, 0, NO_PAD_CTRL) 413 - 414 - #define MX25_PAD_KPP_COL3__KPP_COL3 IOMUX_PAD(0x3bc, 0x1c4, 0x10, 0, 0, KPP_CTL_COL) 415 - #define MX25_PAD_KPP_COL3__UART4_CTS IOMUX_PAD(0x3bc, 0x1c4, 0x11, 0, 0, NO_PAD_CTRL) 416 - #define MX25_PAD_KPP_COL3__AUD5_TXFS IOMUX_PAD(0x3bc, 0x1c4, 0x12, 0, 0, PAD_CTL_PKE | PAD_CTL_PUS_100K_UP) 417 - #define MX25_PAD_KPP_COL3__GPIO_3_4 IOMUX_PAD(0x3bc, 0x1c4, 0x15, 0, 0, NO_PAD_CTRL) 418 - 419 - #define MX25_PAD_FEC_MDC__FEC_MDC IOMUX_PAD(0x3c0, 0x1c8, 0x10, 0, 0, NO_PAD_CTRL) 420 - #define MX25_PAD_FEC_MDC__AUD4_TXD IOMUX_PAD(0x3c0, 0x1c8, 0x12, 0x464, 1, NO_PAD_CTRL) 421 - #define MX25_PAD_FEC_MDC__GPIO_3_5 IOMUX_PAD(0x3c0, 0x1c8, 0x15, 0, 0, NO_PAD_CTRL) 422 - 423 - #define MX25_PAD_FEC_MDIO__FEC_MDIO IOMUX_PAD(0x3c4, 0x1cc, 0x10, 0, 0, PAD_CTL_HYS | PAD_CTL_PUS_22K_UP) 424 - #define MX25_PAD_FEC_MDIO__AUD4_RXD IOMUX_PAD(0x3c4, 0x1cc, 0x12, 0x460, 1, NO_PAD_CTRL) 425 - #define MX25_PAD_FEC_MDIO__GPIO_3_6 IOMUX_PAD(0x3c4, 0x1cc, 0x15, 0, 0, NO_PAD_CTRL) 426 - 427 - #define MX25_PAD_FEC_TDATA0__FEC_TDATA0 IOMUX_PAD(0x3c8, 0x1d0, 0x10, 0, 0, NO_PAD_CTRL) 428 - #define MX25_PAD_FEC_TDATA0__GPIO_3_7 IOMUX_PAD(0x3c8, 0x1d0, 0x15, 0, 0, NO_PAD_CTRL) 429 - 430 - #define MX25_PAD_FEC_TDATA1__FEC_TDATA1 IOMUX_PAD(0x3cc, 0x1d4, 0x10, 0, 0, NO_PAD_CTRL) 431 - #define MX25_PAD_FEC_TDATA1__AUD4_TXFS IOMUX_PAD(0x3cc, 0x1d4, 0x12, 0x474, 1, NO_PAD_CTRL) 432 - #define MX25_PAD_FEC_TDATA1__GPIO_3_8 IOMUX_PAD(0x3cc, 0x1d4, 0x15, 0, 0, NO_PAD_CTRL) 433 - 434 - #define MX25_PAD_FEC_TX_EN__FEC_TX_EN IOMUX_PAD(0x3d0, 0x1d8, 0x10, 0, 0, NO_PAD_CTRL) 435 - #define MX25_PAD_FEC_TX_EN__GPIO_3_9 IOMUX_PAD(0x3d0, 0x1d8, 0x15, 0, 0, NO_PAD_CTRL) 436 - 437 - #define MX25_PAD_FEC_RDATA0__FEC_RDATA0 IOMUX_PAD(0x3d4, 0x1dc, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTRL) 438 - #define MX25_PAD_FEC_RDATA0__GPIO_3_10 IOMUX_PAD(0x3d4, 0x1dc, 0x15, 0, 0, NO_PAD_CTRL) 439 - 440 - #define MX25_PAD_FEC_RDATA1__FEC_RDATA1 IOMUX_PAD(0x3d8, 0x1e0, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTRL) 441 - #define MX25_PAD_FEC_RDATA1__GPIO_3_11 IOMUX_PAD(0x3d8, 0x1e0, 0x15, 0, 0, NO_PAD_CTRL) 442 - 443 - #define MX25_PAD_FEC_RX_DV__FEC_RX_DV IOMUX_PAD(0x3dc, 0x1e4, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTRL) 444 - #define MX25_PAD_FEC_RX_DV__CAN2_RX IOMUX_PAD(0x3dc, 0x1e4, 0x14, 0x484, 0, PAD_CTL_PUS_22K_UP) 445 - #define MX25_PAD_FEC_RX_DV__GPIO_3_12 IOMUX_PAD(0x3dc, 0x1e4, 0x15, 0, 0, NO_PAD_CTRL) 446 - 447 - #define MX25_PAD_FEC_TX_CLK__FEC_TX_CLK IOMUX_PAD(0x3e0, 0x1e8, 0x10, 0, 0, PAD_CTL_HYS | PAD_CTL_PUS_100K_DOWN) 448 - #define MX25_PAD_FEC_TX_CLK__GPIO_3_13 IOMUX_PAD(0x3e0, 0x1e8, 0x15, 0, 0, NO_PAD_CTRL) 449 - 450 - #define MX25_PAD_RTCK__RTCK IOMUX_PAD(0x3e4, 0x1ec, 0x10, 0, 0, NO_PAD_CTRL) 451 - #define MX25_PAD_RTCK__OWIRE IOMUX_PAD(0x3e4, 0x1ec, 0x11, 0, 0, NO_PAD_CTRL) 452 - #define MX25_PAD_RTCK__GPIO_3_14 IOMUX_PAD(0x3e4, 0x1ec, 0x15, 0, 0, NO_PAD_CTRL) 453 - 454 - #define MX25_PAD_DE_B__DE_B IOMUX_PAD(0x3ec, 0x1f0, 0x10, 0, 0, NO_PAD_CTRL) 455 - #define MX25_PAD_DE_B__GPIO_2_20 IOMUX_PAD(0x3ec, 0x1f0, 0x15, 0, 0, NO_PAD_CTRL) 456 - 457 - #define MX25_PAD_TDO__TDO IOMUX_PAD(0x3e8, 0x000, 0x00, 0, 0, NO_PAD_CTRL) 458 - 459 - #define MX25_PAD_GPIO_A__GPIO_A IOMUX_PAD(0x3f0, 0x1f4, 0x10, 0, 0, NO_PAD_CTRL) 460 - #define MX25_PAD_GPIO_A__CAN1_TX IOMUX_PAD(0x3f0, 0x1f4, 0x16, 0, 0, PAD_CTL_PUS_22K_UP) 461 - #define MX25_PAD_GPIO_A__USBOTG_PWR IOMUX_PAD(0x3f0, 0x1f4, 0x12, 0, 0, PAD_CTL_PKE) 462 - 463 - #define MX25_PAD_GPIO_B__GPIO_B IOMUX_PAD(0x3f4, 0x1f8, 0x10, 0, 0, NO_PAD_CTRL) 464 - #define MX25_PAD_GPIO_B__CAN1_RX IOMUX_PAD(0x3f4, 0x1f8, 0x16, 0x480, 1, PAD_CTL_PUS_22K_UP) 465 - #define MX25_PAD_GPIO_B__USBOTG_OC IOMUX_PAD(0x3f4, 0x1f8, 0x12, 0x57c, 1, PAD_CTL_PUS_100K_UP) 466 - 467 - #define MX25_PAD_GPIO_C__GPIO_C IOMUX_PAD(0x3f8, 0x1fc, 0x10, 0, 0, NO_PAD_CTRL) 468 - #define MX25_PAD_GPIO_C__CAN2_TX IOMUX_PAD(0x3f8, 0x1fc, 0x16, 0, 0, PAD_CTL_PUS_22K_UP) 469 - 470 - #define MX25_PAD_GPIO_D__GPIO_D IOMUX_PAD(0x3fc, 0x200, 0x10, 0, 0, NO_PAD_CTRL) 471 - #define MX25_PAD_GPIO_E__LD16 IOMUX_PAD(0x400, 0x204, 0x02, 0, 0, PAD_CTL_SRE_FAST) 472 - #define MX25_PAD_GPIO_D__CAN2_RX IOMUX_PAD(0x3fc, 0x200, 0x16, 0x484, 1, PAD_CTL_PUS_22K_UP) 473 - 474 - #define MX25_PAD_GPIO_E__GPIO_E IOMUX_PAD(0x400, 0x204, 0x10, 0, 0, NO_PAD_CTRL) 475 - #define MX25_PAD_GPIO_F__LD17 IOMUX_PAD(0x404, 0x208, 0x02, 0, 0, PAD_CTL_SRE_FAST) 476 - #define MX25_PAD_GPIO_E__AUD7_TXD IOMUX_PAD(0x400, 0x204, 0x14, 0, 0, NO_PAD_CTRL) 477 - 478 - #define MX25_PAD_GPIO_F__GPIO_F IOMUX_PAD(0x404, 0x208, 0x10, 0, 0, NO_PAD_CTRL) 479 - #define MX25_PAD_GPIO_F__AUD7_TXC IOMUX_PAD(0x404, 0x208, 0x14, 0, 0, NO_PAD_CTRL) 480 - 481 - #define MX25_PAD_EXT_ARMCLK__EXT_ARMCLK IOMUX_PAD(0x000, 0x20c, 0x10, 0, 0, NO_PAD_CTRL) 482 - #define MX25_PAD_EXT_ARMCLK__GPIO_3_15 IOMUX_PAD(0x000, 0x20c, 0x15, 0, 0, NO_PAD_CTRL) 483 - 484 - #define MX25_PAD_UPLL_BYPCLK__UPLL_BYPCLK IOMUX_PAD(0x000, 0x210, 0x10, 0, 0, NO_PAD_CTRL) 485 - #define MX25_PAD_UPLL_BYPCLK__GPIO_3_16 IOMUX_PAD(0x000, 0x210, 0x15, 0, 0, NO_PAD_CTRL) 486 - 487 - #define MX25_PAD_VSTBY_REQ__VSTBY_REQ IOMUX_PAD(0x408, 0x214, 0x10, 0, 0, NO_PAD_CTRL) 488 - #define MX25_PAD_VSTBY_REQ__AUD7_TXFS IOMUX_PAD(0x408, 0x214, 0x14, 0, 0, NO_PAD_CTRL) 489 - #define MX25_PAD_VSTBY_REQ__GPIO_3_17 IOMUX_PAD(0x408, 0x214, 0x15, 0, 0, NO_PAD_CTRL) 490 - #define MX25_PAD_VSTBY_ACK__VSTBY_ACK IOMUX_PAD(0x40c, 0x218, 0x10, 0, 0, NO_PAD_CTRL) 491 - #define MX25_PAD_VSTBY_ACK__GPIO_3_18 IOMUX_PAD(0x40c, 0x218, 0x15, 0, 0, NO_PAD_CTRL) 492 - 493 - #define MX25_PAD_POWER_FAIL__POWER_FAIL IOMUX_PAD(0x410, 0x21c, 0x10, 0, 0, NO_PAD_CTRL) 494 - #define MX25_PAD_POWER_FAIL__AUD7_RXD IOMUX_PAD(0x410, 0x21c, 0x14, 0x478, 1, NO_PAD_CTRL) 495 - #define MX25_PAD_POWER_FAIL__GPIO_3_19 IOMUX_PAD(0x410, 0x21c, 0x15, 0, 0, NO_PAD_CTRL) 496 - 497 - #define MX25_PAD_CLKO__CLKO IOMUX_PAD(0x414, 0x220, 0x10, 0, 0, NO_PAD_CTRL) 498 - #define MX25_PAD_CLKO__GPIO_2_21 IOMUX_PAD(0x414, 0x220, 0x15, 0, 0, NO_PAD_CTRL) 499 - 500 - #define MX25_PAD_BOOT_MODE0__BOOT_MODE0 IOMUX_PAD(0x000, 0x224, 0x00, 0, 0, NO_PAD_CTRL) 501 - #define MX25_PAD_BOOT_MODE0__GPIO_4_30 IOMUX_PAD(0x000, 0x224, 0x05, 0, 0, NO_PAD_CTRL) 502 - #define MX25_PAD_BOOT_MODE1__BOOT_MODE1 IOMUX_PAD(0x000, 0x228, 0x00, 0, 0, NO_PAD_CTRL) 503 - #define MX25_PAD_BOOT_MODE1__GPIO_4_31 IOMUX_PAD(0x000, 0x228, 0x05, 0, 0, NO_PAD_CTRL) 504 - 505 - #define MX25_PAD_CTL_GRP_DVS_MISC IOMUX_PAD(0x418, 0x000, 0, 0, 0, NO_PAD_CTRL) 506 - #define MX25_PAD_CTL_GRP_DSE_FEC IOMUX_PAD(0x41c, 0x000, 0, 0, 0, NO_PAD_CTRL) 507 - #define MX25_PAD_CTL_GRP_DVS_JTAG IOMUX_PAD(0x420, 0x000, 0, 0, 0, NO_PAD_CTRL) 508 - #define MX25_PAD_CTL_GRP_DSE_NFC IOMUX_PAD(0x424, 0x000, 0, 0, 0, NO_PAD_CTRL) 509 - #define MX25_PAD_CTL_GRP_DSE_CSI IOMUX_PAD(0x428, 0x000, 0, 0, 0, NO_PAD_CTRL) 510 - #define MX25_PAD_CTL_GRP_DSE_WEIM IOMUX_PAD(0x42c, 0x000, 0, 0, 0, NO_PAD_CTRL) 511 - #define MX25_PAD_CTL_GRP_DSE_DDR IOMUX_PAD(0x430, 0x000, 0, 0, 0, NO_PAD_CTRL) 512 - #define MX25_PAD_CTL_GRP_DVS_CRM IOMUX_PAD(0x434, 0x000, 0, 0, 0, NO_PAD_CTRL) 513 - #define MX25_PAD_CTL_GRP_DSE_KPP IOMUX_PAD(0x438, 0x000, 0, 0, 0, NO_PAD_CTRL) 514 - #define MX25_PAD_CTL_GRP_DSE_SDHC1 IOMUX_PAD(0x43c, 0x000, 0, 0, 0, NO_PAD_CTRL) 515 - #define MX25_PAD_CTL_GRP_DSE_LCD IOMUX_PAD(0x440, 0x000, 0, 0, 0, NO_PAD_CTRL) 516 - #define MX25_PAD_CTL_GRP_DSE_UART IOMUX_PAD(0x444, 0x000, 0, 0, 0, NO_PAD_CTRL) 517 - #define MX25_PAD_CTL_GRP_DVS_NFC IOMUX_PAD(0x448, 0x000, 0, 0, 0, NO_PAD_CTRL) 518 - #define MX25_PAD_CTL_GRP_DVS_CSI IOMUX_PAD(0x44c, 0x000, 0, 0, 0, NO_PAD_CTRL) 519 - #define MX25_PAD_CTL_GRP_DSE_CSPI1 IOMUX_PAD(0x450, 0x000, 0, 0, 0, NO_PAD_CTRL) 520 - #define MX25_PAD_CTL_GRP_DDRTYPE IOMUX_PAD(0x454, 0x000, 0, 0, 0, NO_PAD_CTRL) 521 - #define MX25_PAD_CTL_GRP_DVS_SDHC1 IOMUX_PAD(0x458, 0x000, 0, 0, 0, NO_PAD_CTRL) 522 - #define MX25_PAD_CTL_GRP_DVS_LCD IOMUX_PAD(0x45c, 0x000, 0, 0, 0, NO_PAD_CTRL) 523 - 524 - #endif /* __MACH_IOMUX_MX25_H__ */
+1 -1
arch/arm/mach-imx/iomux-mx3.h
··· 114 114 */ 115 115 int mxc_iomux_alloc_pin(unsigned int pin, const char *label); 116 116 /* 117 - * setups mutliple pins 117 + * setups multiple pins 118 118 * convenient way to call the above function with tables 119 119 */ 120 120 int mxc_iomux_setup_multiple_pins(const unsigned int *pin_list, unsigned count,
+3 -2
arch/arm/mach-imx/iomux-v3.c
··· 56 56 return 0; 57 57 } 58 58 59 - int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count) 59 + int mxc_iomux_v3_setup_multiple_pads(const iomux_v3_cfg_t *pad_list, 60 + unsigned count) 60 61 { 61 - iomux_v3_cfg_t *p = pad_list; 62 + const iomux_v3_cfg_t *p = pad_list; 62 63 int i; 63 64 int ret; 64 65
+3 -2
arch/arm/mach-imx/iomux-v3.h
··· 128 128 int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t pad); 129 129 130 130 /* 131 - * setups mutliple pads 131 + * setups multiple pads 132 132 * convenient way to call the above function with tables 133 133 */ 134 - int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count); 134 + int mxc_iomux_v3_setup_multiple_pads(const iomux_v3_cfg_t *pad_list, 135 + unsigned count); 135 136 136 137 /* 137 138 * Initialise the iomux controller
+1 -1
arch/arm/mach-imx/mach-cpuimx35.c
··· 75 75 }, 76 76 }; 77 77 78 - static iomux_v3_cfg_t eukrea_cpuimx35_pads[] = { 78 + static const iomux_v3_cfg_t eukrea_cpuimx35_pads[] __initconst = { 79 79 /* UART1 */ 80 80 MX35_PAD_CTS1__UART1_CTS, 81 81 MX35_PAD_RTS1__UART1_RTS,
-172
arch/arm/mach-imx/mach-eukrea_cpuimx25.c
··· 1 - /* 2 - * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de> 3 - * Copyright 2010 Eric Bénard - Eukréa Electromatique, <eric@eukrea.com> 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License 7 - * as published by the Free Software Foundation; either version 2 8 - * of the License, or (at your option) any later version. 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU General Public License 15 - * along with this program; if not, write to the Free Software 16 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 - * Boston, MA 02110-1301, USA. 18 - */ 19 - 20 - #include <linux/types.h> 21 - #include <linux/init.h> 22 - #include <linux/delay.h> 23 - #include <linux/clk.h> 24 - #include <linux/irq.h> 25 - #include <linux/gpio.h> 26 - #include <linux/platform_device.h> 27 - #include <linux/usb/otg.h> 28 - #include <linux/usb/ulpi.h> 29 - 30 - #include <asm/mach-types.h> 31 - #include <asm/mach/arch.h> 32 - #include <asm/mach/time.h> 33 - #include <asm/memory.h> 34 - #include <asm/mach/map.h> 35 - 36 - #include "common.h" 37 - #include "devices-imx25.h" 38 - #include "ehci.h" 39 - #include "eukrea-baseboards.h" 40 - #include "hardware.h" 41 - #include "iomux-mx25.h" 42 - #include "mx25.h" 43 - 44 - static const struct imxuart_platform_data uart_pdata __initconst = { 45 - .flags = IMXUART_HAVE_RTSCTS, 46 - }; 47 - 48 - static iomux_v3_cfg_t eukrea_cpuimx25_pads[] = { 49 - /* FEC - RMII */ 50 - MX25_PAD_FEC_MDC__FEC_MDC, 51 - MX25_PAD_FEC_MDIO__FEC_MDIO, 52 - MX25_PAD_FEC_TDATA0__FEC_TDATA0, 53 - MX25_PAD_FEC_TDATA1__FEC_TDATA1, 54 - MX25_PAD_FEC_TX_EN__FEC_TX_EN, 55 - MX25_PAD_FEC_RDATA0__FEC_RDATA0, 56 - MX25_PAD_FEC_RDATA1__FEC_RDATA1, 57 - MX25_PAD_FEC_RX_DV__FEC_RX_DV, 58 - MX25_PAD_FEC_TX_CLK__FEC_TX_CLK, 59 - /* I2C1 */ 60 - MX25_PAD_I2C1_CLK__I2C1_CLK, 61 - MX25_PAD_I2C1_DAT__I2C1_DAT, 62 - }; 63 - 64 - static const struct fec_platform_data mx25_fec_pdata __initconst = { 65 - .phy = PHY_INTERFACE_MODE_RMII, 66 - }; 67 - 68 - static const struct mxc_nand_platform_data 69 - eukrea_cpuimx25_nand_board_info __initconst = { 70 - .width = 1, 71 - .hw_ecc = 1, 72 - .flash_bbt = 1, 73 - }; 74 - 75 - static const struct imxi2c_platform_data 76 - eukrea_cpuimx25_i2c0_data __initconst = { 77 - .bitrate = 100000, 78 - }; 79 - 80 - static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = { 81 - { 82 - I2C_BOARD_INFO("pcf8563", 0x51), 83 - }, 84 - }; 85 - 86 - static int eukrea_cpuimx25_otg_init(struct platform_device *pdev) 87 - { 88 - return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); 89 - } 90 - 91 - static const struct mxc_usbh_platform_data otg_pdata __initconst = { 92 - .init = eukrea_cpuimx25_otg_init, 93 - .portsc = MXC_EHCI_MODE_UTMI, 94 - }; 95 - 96 - static int eukrea_cpuimx25_usbh2_init(struct platform_device *pdev) 97 - { 98 - return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI | 99 - MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN); 100 - } 101 - 102 - static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { 103 - .init = eukrea_cpuimx25_usbh2_init, 104 - .portsc = MXC_EHCI_MODE_SERIAL, 105 - }; 106 - 107 - static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { 108 - .operating_mode = FSL_USB2_DR_DEVICE, 109 - .phy_mode = FSL_USB2_PHY_UTMI, 110 - .workaround = FLS_USB2_WORKAROUND_ENGCM09152, 111 - }; 112 - 113 - static bool otg_mode_host __initdata; 114 - 115 - static int __init eukrea_cpuimx25_otg_mode(char *options) 116 - { 117 - if (!strcmp(options, "host")) 118 - otg_mode_host = true; 119 - else if (!strcmp(options, "device")) 120 - otg_mode_host = false; 121 - else 122 - pr_info("otg_mode neither \"host\" nor \"device\". " 123 - "Defaulting to device\n"); 124 - return 1; 125 - } 126 - __setup("otg_mode=", eukrea_cpuimx25_otg_mode); 127 - 128 - static void __init eukrea_cpuimx25_init(void) 129 - { 130 - imx25_soc_init(); 131 - 132 - if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, 133 - ARRAY_SIZE(eukrea_cpuimx25_pads))) 134 - printk(KERN_ERR "error setting cpuimx25 pads !\n"); 135 - 136 - imx25_add_imx_uart0(&uart_pdata); 137 - imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info); 138 - imx25_add_imxdi_rtc(); 139 - imx25_add_fec(&mx25_fec_pdata); 140 - imx25_add_imx2_wdt(); 141 - 142 - i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices, 143 - ARRAY_SIZE(eukrea_cpuimx25_i2c_devices)); 144 - imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data); 145 - 146 - if (otg_mode_host) 147 - imx25_add_mxc_ehci_otg(&otg_pdata); 148 - else 149 - imx25_add_fsl_usb2_udc(&otg_device_pdata); 150 - 151 - imx25_add_mxc_ehci_hs(&usbh2_pdata); 152 - 153 - #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD 154 - eukrea_mbimxsd25_baseboard_init(); 155 - #endif 156 - } 157 - 158 - static void __init eukrea_cpuimx25_timer_init(void) 159 - { 160 - mx25_clocks_init(); 161 - } 162 - 163 - MACHINE_START(EUKREA_CPUIMX25SD, "Eukrea CPUIMX25") 164 - /* Maintainer: Eukrea Electromatique */ 165 - .atag_offset = 0x100, 166 - .map_io = mx25_map_io, 167 - .init_early = imx25_init_early, 168 - .init_irq = mx25_init_irq, 169 - .init_time = eukrea_cpuimx25_timer_init, 170 - .init_machine = eukrea_cpuimx25_init, 171 - .restart = mxc_restart, 172 - MACHINE_END
-270
arch/arm/mach-imx/mach-mx25_3ds.c
··· 1 - /* 2 - * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de> 3 - * 4 - * This program is free software; you can redistribute it and/or 5 - * modify it under the terms of the GNU General Public License 6 - * as published by the Free Software Foundation; either version 2 7 - * of the License, or (at your option) any later version. 8 - * This program is distributed in the hope that it will be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 - * 13 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, write to the Free Software 15 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 - * Boston, MA 02110-1301, USA. 17 - */ 18 - 19 - /* 20 - * This machine is known as: 21 - * - i.MX25 3-Stack Development System 22 - * - i.MX25 Platform Development Kit (i.MX25 PDK) 23 - */ 24 - 25 - #include <linux/types.h> 26 - #include <linux/init.h> 27 - #include <linux/delay.h> 28 - #include <linux/clk.h> 29 - #include <linux/irq.h> 30 - #include <linux/gpio.h> 31 - #include <linux/platform_device.h> 32 - #include <linux/usb/otg.h> 33 - 34 - #include <asm/mach-types.h> 35 - #include <asm/mach/arch.h> 36 - #include <asm/mach/time.h> 37 - #include <asm/memory.h> 38 - #include <asm/mach/map.h> 39 - 40 - #include "common.h" 41 - #include "devices-imx25.h" 42 - #include "ehci.h" 43 - #include "hardware.h" 44 - #include "iomux-mx25.h" 45 - #include "mx25.h" 46 - 47 - #define MX25PDK_CAN_PWDN IMX_GPIO_NR(4, 6) 48 - 49 - static const struct imxuart_platform_data uart_pdata __initconst = { 50 - .flags = IMXUART_HAVE_RTSCTS, 51 - }; 52 - 53 - static iomux_v3_cfg_t mx25pdk_pads[] = { 54 - MX25_PAD_FEC_MDC__FEC_MDC, 55 - MX25_PAD_FEC_MDIO__FEC_MDIO, 56 - MX25_PAD_FEC_TDATA0__FEC_TDATA0, 57 - MX25_PAD_FEC_TDATA1__FEC_TDATA1, 58 - MX25_PAD_FEC_TX_EN__FEC_TX_EN, 59 - MX25_PAD_FEC_RDATA0__FEC_RDATA0, 60 - MX25_PAD_FEC_RDATA1__FEC_RDATA1, 61 - MX25_PAD_FEC_RX_DV__FEC_RX_DV, 62 - MX25_PAD_FEC_TX_CLK__FEC_TX_CLK, 63 - MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */ 64 - MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */ 65 - 66 - /* LCD */ 67 - MX25_PAD_LD0__LD0, 68 - MX25_PAD_LD1__LD1, 69 - MX25_PAD_LD2__LD2, 70 - MX25_PAD_LD3__LD3, 71 - MX25_PAD_LD4__LD4, 72 - MX25_PAD_LD5__LD5, 73 - MX25_PAD_LD6__LD6, 74 - MX25_PAD_LD7__LD7, 75 - MX25_PAD_LD8__LD8, 76 - MX25_PAD_LD9__LD9, 77 - MX25_PAD_LD10__LD10, 78 - MX25_PAD_LD11__LD11, 79 - MX25_PAD_LD12__LD12, 80 - MX25_PAD_LD13__LD13, 81 - MX25_PAD_LD14__LD14, 82 - MX25_PAD_LD15__LD15, 83 - MX25_PAD_GPIO_E__LD16, 84 - MX25_PAD_GPIO_F__LD17, 85 - MX25_PAD_HSYNC__HSYNC, 86 - MX25_PAD_VSYNC__VSYNC, 87 - MX25_PAD_LSCLK__LSCLK, 88 - MX25_PAD_OE_ACD__OE_ACD, 89 - MX25_PAD_CONTRAST__CONTRAST, 90 - 91 - /* Keypad */ 92 - MX25_PAD_KPP_ROW0__KPP_ROW0, 93 - MX25_PAD_KPP_ROW1__KPP_ROW1, 94 - MX25_PAD_KPP_ROW2__KPP_ROW2, 95 - MX25_PAD_KPP_ROW3__KPP_ROW3, 96 - MX25_PAD_KPP_COL0__KPP_COL0, 97 - MX25_PAD_KPP_COL1__KPP_COL1, 98 - MX25_PAD_KPP_COL2__KPP_COL2, 99 - MX25_PAD_KPP_COL3__KPP_COL3, 100 - 101 - /* SD1 */ 102 - MX25_PAD_SD1_CMD__SD1_CMD, 103 - MX25_PAD_SD1_CLK__SD1_CLK, 104 - MX25_PAD_SD1_DATA0__SD1_DATA0, 105 - MX25_PAD_SD1_DATA1__SD1_DATA1, 106 - MX25_PAD_SD1_DATA2__SD1_DATA2, 107 - MX25_PAD_SD1_DATA3__SD1_DATA3, 108 - MX25_PAD_A14__GPIO_2_0, /* WriteProtect */ 109 - MX25_PAD_A15__GPIO_2_1, /* CardDetect */ 110 - 111 - /* I2C1 */ 112 - MX25_PAD_I2C1_CLK__I2C1_CLK, 113 - MX25_PAD_I2C1_DAT__I2C1_DAT, 114 - 115 - /* CAN1 */ 116 - MX25_PAD_GPIO_A__CAN1_TX, 117 - MX25_PAD_GPIO_B__CAN1_RX, 118 - MX25_PAD_D14__GPIO_4_6, /* CAN_PWDN */ 119 - }; 120 - 121 - static const struct fec_platform_data mx25_fec_pdata __initconst = { 122 - .phy = PHY_INTERFACE_MODE_RMII, 123 - }; 124 - 125 - #define FEC_ENABLE_GPIO IMX_GPIO_NR(2, 3) 126 - #define FEC_RESET_B_GPIO IMX_GPIO_NR(4, 8) 127 - 128 - static void __init mx25pdk_fec_reset(void) 129 - { 130 - gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable"); 131 - gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset"); 132 - 133 - gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */ 134 - gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */ 135 - udelay(2); 136 - 137 - /* turn on PHY power and lift reset */ 138 - gpio_set_value(FEC_ENABLE_GPIO, 1); 139 - gpio_set_value(FEC_RESET_B_GPIO, 1); 140 - } 141 - 142 - static const struct mxc_nand_platform_data 143 - mx25pdk_nand_board_info __initconst = { 144 - .width = 1, 145 - .hw_ecc = 1, 146 - .flash_bbt = 1, 147 - }; 148 - 149 - static struct imx_fb_videomode mx25pdk_modes[] = { 150 - { 151 - .mode = { 152 - .name = "CRT-VGA", 153 - .refresh = 60, 154 - .xres = 640, 155 - .yres = 480, 156 - .pixclock = 39683, 157 - .left_margin = 45, 158 - .right_margin = 114, 159 - .upper_margin = 33, 160 - .lower_margin = 11, 161 - .hsync_len = 1, 162 - .vsync_len = 1, 163 - }, 164 - .bpp = 16, 165 - .pcr = 0xFA208B80, 166 - }, 167 - }; 168 - 169 - static const struct imx_fb_platform_data mx25pdk_fb_pdata __initconst = { 170 - .mode = mx25pdk_modes, 171 - .num_modes = ARRAY_SIZE(mx25pdk_modes), 172 - .pwmr = 0x00A903FF, 173 - .lscr1 = 0x00120300, 174 - .dmacr = 0x00020010, 175 - }; 176 - 177 - static const uint32_t mx25pdk_keymap[] = { 178 - KEY(0, 0, KEY_UP), 179 - KEY(0, 1, KEY_DOWN), 180 - KEY(0, 2, KEY_VOLUMEDOWN), 181 - KEY(0, 3, KEY_HOME), 182 - KEY(1, 0, KEY_RIGHT), 183 - KEY(1, 1, KEY_LEFT), 184 - KEY(1, 2, KEY_ENTER), 185 - KEY(1, 3, KEY_VOLUMEUP), 186 - KEY(2, 0, KEY_F6), 187 - KEY(2, 1, KEY_F8), 188 - KEY(2, 2, KEY_F9), 189 - KEY(2, 3, KEY_F10), 190 - KEY(3, 0, KEY_F1), 191 - KEY(3, 1, KEY_F2), 192 - KEY(3, 2, KEY_F3), 193 - KEY(3, 3, KEY_POWER), 194 - }; 195 - 196 - static const struct matrix_keymap_data mx25pdk_keymap_data __initconst = { 197 - .keymap = mx25pdk_keymap, 198 - .keymap_size = ARRAY_SIZE(mx25pdk_keymap), 199 - }; 200 - 201 - static int mx25pdk_usbh2_init(struct platform_device *pdev) 202 - { 203 - return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY); 204 - } 205 - 206 - static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { 207 - .init = mx25pdk_usbh2_init, 208 - .portsc = MXC_EHCI_MODE_SERIAL, 209 - }; 210 - 211 - static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { 212 - .operating_mode = FSL_USB2_DR_DEVICE, 213 - .phy_mode = FSL_USB2_PHY_UTMI, 214 - }; 215 - 216 - static const struct imxi2c_platform_data mx25_3ds_i2c0_data __initconst = { 217 - .bitrate = 100000, 218 - }; 219 - 220 - #define SD1_GPIO_WP IMX_GPIO_NR(2, 0) 221 - #define SD1_GPIO_CD IMX_GPIO_NR(2, 1) 222 - 223 - static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = { 224 - .wp_gpio = SD1_GPIO_WP, 225 - .cd_gpio = SD1_GPIO_CD, 226 - .wp_type = ESDHC_WP_GPIO, 227 - .cd_type = ESDHC_CD_GPIO, 228 - }; 229 - 230 - static void __init mx25pdk_init(void) 231 - { 232 - imx25_soc_init(); 233 - 234 - mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads, 235 - ARRAY_SIZE(mx25pdk_pads)); 236 - 237 - imx25_add_imx_uart0(&uart_pdata); 238 - imx25_add_fsl_usb2_udc(&otg_device_pdata); 239 - imx25_add_mxc_ehci_hs(&usbh2_pdata); 240 - imx25_add_mxc_nand(&mx25pdk_nand_board_info); 241 - imx25_add_imxdi_rtc(); 242 - imx25_add_imx_fb(&mx25pdk_fb_pdata); 243 - imx25_add_imx2_wdt(); 244 - 245 - mx25pdk_fec_reset(); 246 - imx25_add_fec(&mx25_fec_pdata); 247 - imx25_add_imx_keypad(&mx25pdk_keymap_data); 248 - 249 - imx25_add_sdhci_esdhc_imx(0, &mx25pdk_esdhc_pdata); 250 - imx25_add_imx_i2c0(&mx25_3ds_i2c0_data); 251 - 252 - gpio_request_one(MX25PDK_CAN_PWDN, GPIOF_OUT_INIT_LOW, "can-pwdn"); 253 - imx25_add_flexcan0(); 254 - } 255 - 256 - static void __init mx25pdk_timer_init(void) 257 - { 258 - mx25_clocks_init(); 259 - } 260 - 261 - MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)") 262 - /* Maintainer: Freescale Semiconductor, Inc. */ 263 - .atag_offset = 0x100, 264 - .map_io = mx25_map_io, 265 - .init_early = imx25_init_early, 266 - .init_irq = mx25_init_irq, 267 - .init_time = mx25pdk_timer_init, 268 - .init_machine = mx25pdk_init, 269 - .restart = mxc_restart, 270 - MACHINE_END
+1 -1
arch/arm/mach-imx/mach-mx35_3ds.c
··· 166 166 &mx35pdk_flash, 167 167 }; 168 168 169 - static iomux_v3_cfg_t mx35pdk_pads[] = { 169 + static const iomux_v3_cfg_t mx35pdk_pads[] __initconst = { 170 170 /* UART1 */ 171 171 MX35_PAD_CTS1__UART1_CTS, 172 172 MX35_PAD_RTS1__UART1_RTS,
+1 -1
arch/arm/mach-imx/mach-pcm043.c
··· 129 129 &pcm043_flash, 130 130 }; 131 131 132 - static iomux_v3_cfg_t pcm043_pads[] = { 132 + static const iomux_v3_cfg_t pcm043_pads[] __initconst = { 133 133 /* UART1 */ 134 134 MX35_PAD_CTS1__UART1_CTS, 135 135 MX35_PAD_RTS1__UART1_RTS,
+1 -1
arch/arm/mach-imx/mach-vpr200.c
··· 161 161 } 162 162 }; 163 163 164 - static iomux_v3_cfg_t vpr200_pads[] = { 164 + static const iomux_v3_cfg_t vpr200_pads[] __initconst = { 165 165 /* UART1 */ 166 166 MX35_PAD_TXD1__UART1_TXD_MUX, 167 167 MX35_PAD_RXD1__UART1_RXD_MUX,
-89
arch/arm/mach-imx/mm-imx25.c
··· 1 - /* 2 - * Copyright (C) 1999,2000 Arm Limited 3 - * Copyright (C) 2000 Deep Blue Solutions Ltd 4 - * Copyright (C) 2002 Shane Nay (shane@minirl.com) 5 - * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved. 6 - * - add MX31 specific definitions 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - */ 18 - 19 - #include <linux/mm.h> 20 - #include <linux/init.h> 21 - #include <linux/err.h> 22 - #include <linux/pinctrl/machine.h> 23 - 24 - #include <asm/pgtable.h> 25 - #include <asm/mach/map.h> 26 - 27 - #include "common.h" 28 - #include "devices/devices-common.h" 29 - #include "hardware.h" 30 - #include "iomux-v3.h" 31 - #include "mx25.h" 32 - 33 - /* 34 - * This table defines static virtual address mappings for I/O regions. 35 - * These are the mappings common across all MX25 boards. 36 - */ 37 - static struct map_desc mx25_io_desc[] __initdata = { 38 - imx_map_entry(MX25, AVIC, MT_DEVICE_NONSHARED), 39 - imx_map_entry(MX25, AIPS1, MT_DEVICE_NONSHARED), 40 - imx_map_entry(MX25, AIPS2, MT_DEVICE_NONSHARED), 41 - }; 42 - 43 - /* 44 - * This function initializes the memory map. It is called during the 45 - * system startup to create static physical to virtual memory mappings 46 - * for the IO modules. 47 - */ 48 - void __init mx25_map_io(void) 49 - { 50 - iotable_init(mx25_io_desc, ARRAY_SIZE(mx25_io_desc)); 51 - } 52 - 53 - void __init imx25_init_early(void) 54 - { 55 - mxc_set_cpu_type(MXC_CPU_MX25); 56 - mxc_iomux_v3_init(MX25_IO_ADDRESS(MX25_IOMUXC_BASE_ADDR)); 57 - } 58 - 59 - void __init mx25_init_irq(void) 60 - { 61 - mxc_init_irq(MX25_IO_ADDRESS(MX25_AVIC_BASE_ADDR)); 62 - } 63 - 64 - static struct sdma_platform_data imx25_sdma_pdata __initdata = { 65 - .fw_name = "sdma-imx25.bin", 66 - }; 67 - 68 - static const struct resource imx25_audmux_res[] __initconst = { 69 - DEFINE_RES_MEM(MX25_AUDMUX_BASE_ADDR, SZ_16K), 70 - }; 71 - 72 - void __init imx25_soc_init(void) 73 - { 74 - mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR)); 75 - mxc_device_init(); 76 - 77 - /* i.mx25 has the i.mx35 type gpio */ 78 - mxc_register_gpio("imx35-gpio", 0, MX25_GPIO1_BASE_ADDR, SZ_16K, MX25_INT_GPIO1, 0); 79 - mxc_register_gpio("imx35-gpio", 1, MX25_GPIO2_BASE_ADDR, SZ_16K, MX25_INT_GPIO2, 0); 80 - mxc_register_gpio("imx35-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0); 81 - mxc_register_gpio("imx35-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0); 82 - 83 - pinctrl_provide_dummies(); 84 - /* i.mx25 has the i.mx35 type sdma */ 85 - imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata); 86 - /* i.mx25 has the i.mx31 type audmux */ 87 - platform_device_register_simple("imx31-audmux", 0, imx25_audmux_res, 88 - ARRAY_SIZE(imx25_audmux_res)); 89 - }
-117
arch/arm/mach-imx/mx25.h
··· 1 - #ifndef __MACH_MX25_H__ 2 - #define __MACH_MX25_H__ 3 - 4 - #define MX25_AIPS1_BASE_ADDR 0x43f00000 5 - #define MX25_AIPS1_SIZE SZ_1M 6 - #define MX25_AIPS2_BASE_ADDR 0x53f00000 7 - #define MX25_AIPS2_SIZE SZ_1M 8 - #define MX25_AVIC_BASE_ADDR 0x68000000 9 - #define MX25_AVIC_SIZE SZ_1M 10 - 11 - #define MX25_I2C1_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x80000) 12 - #define MX25_I2C3_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x84000) 13 - #define MX25_CAN1_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x88000) 14 - #define MX25_CAN2_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x8c000) 15 - #define MX25_I2C2_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x98000) 16 - #define MX25_CSPI1_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0xa4000) 17 - #define MX25_IOMUXC_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0xac000) 18 - 19 - #define MX25_CRM_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0x80000) 20 - #define MX25_GPT1_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0x90000) 21 - #define MX25_GPIO4_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0x9c000) 22 - #define MX25_PWM2_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0xa0000) 23 - #define MX25_GPIO3_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0xa4000) 24 - #define MX25_PWM3_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0xa8000) 25 - #define MX25_PWM4_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0xc8000) 26 - #define MX25_GPIO1_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0xcc000) 27 - #define MX25_GPIO2_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0xd0000) 28 - #define MX25_WDOG_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0xdc000) 29 - #define MX25_PWM1_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0xe0000) 30 - 31 - #define MX25_UART1_BASE_ADDR 0x43f90000 32 - #define MX25_UART2_BASE_ADDR 0x43f94000 33 - #define MX25_AUDMUX_BASE_ADDR 0x43fb0000 34 - #define MX25_UART3_BASE_ADDR 0x5000c000 35 - #define MX25_UART4_BASE_ADDR 0x50008000 36 - #define MX25_UART5_BASE_ADDR 0x5002c000 37 - 38 - #define MX25_CSPI3_BASE_ADDR 0x50004000 39 - #define MX25_CSPI2_BASE_ADDR 0x50010000 40 - #define MX25_FEC_BASE_ADDR 0x50038000 41 - #define MX25_SSI2_BASE_ADDR 0x50014000 42 - #define MX25_SSI1_BASE_ADDR 0x50034000 43 - #define MX25_NFC_BASE_ADDR 0xbb000000 44 - #define MX25_IIM_BASE_ADDR 0x53ff0000 45 - #define MX25_DRYICE_BASE_ADDR 0x53ffc000 46 - #define MX25_ESDHC1_BASE_ADDR 0x53fb4000 47 - #define MX25_ESDHC2_BASE_ADDR 0x53fb8000 48 - #define MX25_LCDC_BASE_ADDR 0x53fbc000 49 - #define MX25_KPP_BASE_ADDR 0x43fa8000 50 - #define MX25_SDMA_BASE_ADDR 0x53fd4000 51 - #define MX25_USB_BASE_ADDR 0x53ff4000 52 - #define MX25_USB_OTG_BASE_ADDR (MX25_USB_BASE_ADDR + 0x0000) 53 - /* 54 - * The reference manual (IMX25RM, Rev. 1, 06/2009) specifies an offset of 0x200 55 - * for the host controller. Early documentation drafts specified 0x400 and 56 - * Freescale internal sources confirm only the latter value to work. 57 - */ 58 - #define MX25_USB_HS_BASE_ADDR (MX25_USB_BASE_ADDR + 0x0400) 59 - #define MX25_CSI_BASE_ADDR 0x53ff8000 60 - 61 - #define MX25_IO_P2V(x) IMX_IO_P2V(x) 62 - #define MX25_IO_ADDRESS(x) IOMEM(MX25_IO_P2V(x)) 63 - 64 - /* 65 - * Interrupt numbers 66 - */ 67 - #include <asm/irq.h> 68 - #define MX25_INT_CSPI3 (NR_IRQS_LEGACY + 0) 69 - #define MX25_INT_I2C1 (NR_IRQS_LEGACY + 3) 70 - #define MX25_INT_I2C2 (NR_IRQS_LEGACY + 4) 71 - #define MX25_INT_UART4 (NR_IRQS_LEGACY + 5) 72 - #define MX25_INT_ESDHC2 (NR_IRQS_LEGACY + 8) 73 - #define MX25_INT_ESDHC1 (NR_IRQS_LEGACY + 9) 74 - #define MX25_INT_I2C3 (NR_IRQS_LEGACY + 10) 75 - #define MX25_INT_SSI2 (NR_IRQS_LEGACY + 11) 76 - #define MX25_INT_SSI1 (NR_IRQS_LEGACY + 12) 77 - #define MX25_INT_CSPI2 (NR_IRQS_LEGACY + 13) 78 - #define MX25_INT_CSPI1 (NR_IRQS_LEGACY + 14) 79 - #define MX25_INT_GPIO3 (NR_IRQS_LEGACY + 16) 80 - #define MX25_INT_CSI (NR_IRQS_LEGACY + 17) 81 - #define MX25_INT_UART3 (NR_IRQS_LEGACY + 18) 82 - #define MX25_INT_GPIO4 (NR_IRQS_LEGACY + 23) 83 - #define MX25_INT_KPP (NR_IRQS_LEGACY + 24) 84 - #define MX25_INT_DRYICE (NR_IRQS_LEGACY + 25) 85 - #define MX25_INT_PWM1 (NR_IRQS_LEGACY + 26) 86 - #define MX25_INT_UART2 (NR_IRQS_LEGACY + 32) 87 - #define MX25_INT_NFC (NR_IRQS_LEGACY + 33) 88 - #define MX25_INT_SDMA (NR_IRQS_LEGACY + 34) 89 - #define MX25_INT_USB_HS (NR_IRQS_LEGACY + 35) 90 - #define MX25_INT_PWM2 (NR_IRQS_LEGACY + 36) 91 - #define MX25_INT_USB_OTG (NR_IRQS_LEGACY + 37) 92 - #define MX25_INT_LCDC (NR_IRQS_LEGACY + 39) 93 - #define MX25_INT_UART5 (NR_IRQS_LEGACY + 40) 94 - #define MX25_INT_PWM3 (NR_IRQS_LEGACY + 41) 95 - #define MX25_INT_PWM4 (NR_IRQS_LEGACY + 42) 96 - #define MX25_INT_CAN1 (NR_IRQS_LEGACY + 43) 97 - #define MX25_INT_CAN2 (NR_IRQS_LEGACY + 44) 98 - #define MX25_INT_UART1 (NR_IRQS_LEGACY + 45) 99 - #define MX25_INT_GPIO2 (NR_IRQS_LEGACY + 51) 100 - #define MX25_INT_GPIO1 (NR_IRQS_LEGACY + 52) 101 - #define MX25_INT_GPT1 (NR_IRQS_LEGACY + 54) 102 - #define MX25_INT_FEC (NR_IRQS_LEGACY + 57) 103 - 104 - #define MX25_DMA_REQ_SSI2_RX1 22 105 - #define MX25_DMA_REQ_SSI2_TX1 23 106 - #define MX25_DMA_REQ_SSI2_RX0 24 107 - #define MX25_DMA_REQ_SSI2_TX0 25 108 - #define MX25_DMA_REQ_SSI1_RX1 26 109 - #define MX25_DMA_REQ_SSI1_TX1 27 110 - #define MX25_DMA_REQ_SSI1_RX0 28 111 - #define MX25_DMA_REQ_SSI1_TX0 29 112 - 113 - #ifndef __ASSEMBLY__ 114 - extern int mx25_revision(void); 115 - #endif 116 - 117 - #endif /* ifndef __MACH_MX25_H__ */
-109
arch/arm/mach-msm/Kconfig
··· 1 - if ARCH_MSM 2 - 3 - choice 4 - prompt "Qualcomm MSM SoC Type" 5 - default ARCH_MSM7X00A 6 - depends on ARCH_MSM 7 - 8 - config ARCH_MSM7X00A 9 - bool "MSM7x00A / MSM7x01A" 10 - select ARCH_MSM_ARM11 11 - select CPU_V6 12 - select GPIO_MSM_V1 13 - select MACH_TROUT if !MACH_HALIBUT 14 - select MSM_PROC_COMM 15 - select MSM_SMD 16 - select CLKSRC_QCOM 17 - select MSM_SMD_PKG3 18 - 19 - config ARCH_MSM7X30 20 - bool "MSM7x30" 21 - select ARCH_MSM_SCORPION 22 - select CPU_V7 23 - select GPIO_MSM_V1 24 - select MACH_MSM7X30_SURF # if ! 25 - select MSM_GPIOMUX 26 - select MSM_PROC_COMM 27 - select MSM_SMD 28 - select CLKSRC_QCOM 29 - select MSM_VIC 30 - 31 - config ARCH_QSD8X50 32 - bool "QSD8X50" 33 - select ARCH_MSM_SCORPION 34 - select CPU_V7 35 - select GPIO_MSM_V1 36 - select MACH_QSD8X50_SURF if !MACH_QSD8X50A_ST1_5 37 - select MSM_GPIOMUX 38 - select MSM_PROC_COMM 39 - select MSM_SMD 40 - select CLKSRC_QCOM 41 - select MSM_VIC 42 - 43 - endchoice 44 - 45 - config MSM_SOC_REV_A 46 - bool 47 - 48 - config ARCH_MSM_ARM11 49 - bool 50 - 51 - config ARCH_MSM_SCORPION 52 - bool 53 - 54 - config MSM_VIC 55 - bool 56 - 57 - menu "Qualcomm MSM Board Type" 58 - depends on ARCH_MSM 59 - 60 - config MACH_HALIBUT 61 - depends on ARCH_MSM 62 - depends on ARCH_MSM7X00A 63 - bool "Halibut Board (QCT SURF7201A)" 64 - help 65 - Support for the Qualcomm SURF7201A eval board. 66 - 67 - config MACH_TROUT 68 - depends on ARCH_MSM 69 - depends on ARCH_MSM7X00A 70 - bool "HTC Dream (aka trout)" 71 - help 72 - Support for the HTC Dream, T-Mobile G1, Android ADP1 devices. 73 - 74 - config MACH_MSM7X30_SURF 75 - depends on ARCH_MSM7X30 76 - bool "MSM7x30 SURF" 77 - help 78 - Support for the Qualcomm MSM7x30 SURF eval board. 79 - 80 - config MACH_QSD8X50_SURF 81 - depends on ARCH_QSD8X50 82 - bool "QSD8x50 SURF" 83 - help 84 - Support for the Qualcomm QSD8x50 SURF eval board. 85 - 86 - config MACH_QSD8X50A_ST1_5 87 - depends on ARCH_QSD8X50 88 - bool "QSD8x50A ST1.5" 89 - select MSM_SOC_REV_A 90 - help 91 - Support for the Qualcomm ST1.5. 92 - 93 - endmenu 94 - 95 - config MSM_SMD_PKG3 96 - bool 97 - 98 - config MSM_PROC_COMM 99 - bool 100 - 101 - config MSM_SMD 102 - bool 103 - 104 - config MSM_GPIOMUX 105 - bool 106 - help 107 - Support for MSM V1 TLMM GPIOMUX architecture. 108 - 109 - endif
-23
arch/arm/mach-msm/Makefile
··· 1 - obj-$(CONFIG_MSM_PROC_COMM) += clock.o 2 - 3 - obj-$(CONFIG_MSM_VIC) += irq-vic.o 4 - 5 - obj-$(CONFIG_ARCH_MSM7X00A) += irq.o 6 - obj-$(CONFIG_ARCH_QSD8X50) += sirc.o 7 - 8 - obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o 9 - 10 - obj-$(CONFIG_ARCH_MSM7X00A) += dma.o io.o 11 - obj-$(CONFIG_ARCH_MSM7X30) += dma.o io.o 12 - obj-$(CONFIG_ARCH_QSD8X50) += dma.o io.o 13 - 14 - obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o 15 - obj-$(CONFIG_MSM_SMD) += last_radio_log.o 16 - 17 - obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o 18 - obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o board-trout-panel.o devices-msm7x00.o 19 - obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o 20 - obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o 21 - obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o 22 - obj-$(CONFIG_MSM_GPIOMUX) += gpiomux.o 23 - obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o
-3
arch/arm/mach-msm/Makefile.boot
··· 1 - zreladdr-y += 0x10008000 2 - params_phys-y := 0x10000100 3 - initrd_phys-y := 0x10800000
-110
arch/arm/mach-msm/board-halibut.c
··· 1 - /* linux/arch/arm/mach-msm/board-halibut.c 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - 17 - #include <linux/kernel.h> 18 - #include <linux/init.h> 19 - #include <linux/platform_device.h> 20 - #include <linux/input.h> 21 - #include <linux/io.h> 22 - #include <linux/delay.h> 23 - #include <linux/smc91x.h> 24 - 25 - #include <mach/hardware.h> 26 - #include <asm/mach-types.h> 27 - #include <asm/mach/arch.h> 28 - #include <asm/mach/map.h> 29 - #include <asm/mach/flash.h> 30 - #include <asm/setup.h> 31 - 32 - #include <mach/irqs.h> 33 - #include <mach/msm_iomap.h> 34 - 35 - #include <linux/mtd/nand.h> 36 - #include <linux/mtd/partitions.h> 37 - 38 - #include "devices.h" 39 - #include "common.h" 40 - 41 - static struct resource smc91x_resources[] = { 42 - [0] = { 43 - .start = 0x9C004300, 44 - .end = 0x9C004400, 45 - .flags = IORESOURCE_MEM, 46 - }, 47 - [1] = { 48 - .start = MSM_GPIO_TO_INT(49), 49 - .end = MSM_GPIO_TO_INT(49), 50 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 51 - }, 52 - }; 53 - 54 - static struct smc91x_platdata smc91x_platdata = { 55 - .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 56 - }; 57 - 58 - static struct platform_device smc91x_device = { 59 - .name = "smc91x", 60 - .id = 0, 61 - .num_resources = ARRAY_SIZE(smc91x_resources), 62 - .resource = smc91x_resources, 63 - .dev.platform_data = &smc91x_platdata, 64 - }; 65 - 66 - static struct platform_device *devices[] __initdata = { 67 - &msm_clock_7x01a, 68 - &msm_device_gpio_7201, 69 - &msm_device_uart3, 70 - &msm_device_smd, 71 - &msm_device_nand, 72 - &msm_device_hsusb, 73 - &msm_device_i2c, 74 - &smc91x_device, 75 - }; 76 - 77 - static void __init halibut_init_early(void) 78 - { 79 - arch_ioremap_caller = __msm_ioremap_caller; 80 - } 81 - 82 - static void __init halibut_init_irq(void) 83 - { 84 - msm_init_irq(); 85 - } 86 - 87 - static void __init halibut_init(void) 88 - { 89 - platform_add_devices(devices, ARRAY_SIZE(devices)); 90 - } 91 - 92 - static void __init halibut_map_io(void) 93 - { 94 - msm_map_common_io(); 95 - } 96 - 97 - static void __init halibut_init_late(void) 98 - { 99 - smd_debugfs_init(); 100 - } 101 - 102 - MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)") 103 - .atag_offset = 0x100, 104 - .map_io = halibut_map_io, 105 - .init_early = halibut_init_early, 106 - .init_irq = halibut_init_irq, 107 - .init_machine = halibut_init, 108 - .init_late = halibut_init_late, 109 - .init_time = msm7x01_timer_init, 110 - MACHINE_END
-191
arch/arm/mach-msm/board-msm7x30.c
··· 1 - /* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 - * 02110-1301, USA. 16 - */ 17 - #include <linux/gpio.h> 18 - #include <linux/kernel.h> 19 - #include <linux/irq.h> 20 - #include <linux/platform_device.h> 21 - #include <linux/delay.h> 22 - #include <linux/io.h> 23 - #include <linux/smsc911x.h> 24 - #include <linux/usb/msm_hsusb.h> 25 - #include <linux/clkdev.h> 26 - #include <linux/memblock.h> 27 - 28 - #include <asm/mach-types.h> 29 - #include <asm/mach/arch.h> 30 - #include <asm/memory.h> 31 - #include <asm/setup.h> 32 - 33 - #include <mach/clk.h> 34 - #include <mach/msm_iomap.h> 35 - #include <mach/dma.h> 36 - 37 - #include <mach/vreg.h> 38 - #include "devices.h" 39 - #include "gpiomux.h" 40 - #include "proc_comm.h" 41 - #include "common.h" 42 - 43 - static void __init msm7x30_fixup(struct tag *tag, char **cmdline) 44 - { 45 - for (; tag->hdr.size; tag = tag_next(tag)) 46 - if (tag->hdr.tag == ATAG_MEM && tag->u.mem.start == 0x200000) { 47 - tag->u.mem.start = 0; 48 - tag->u.mem.size += SZ_2M; 49 - } 50 - } 51 - 52 - static void __init msm7x30_reserve(void) 53 - { 54 - memblock_remove(0x0, SZ_2M); 55 - } 56 - 57 - static int hsusb_phy_init_seq[] = { 58 - 0x30, 0x32, /* Enable and set Pre-Emphasis Depth to 20% */ 59 - 0x02, 0x36, /* Disable CDR Auto Reset feature */ 60 - -1 61 - }; 62 - 63 - static int hsusb_link_clk_reset(struct clk *link_clk, bool assert) 64 - { 65 - int ret; 66 - 67 - if (assert) { 68 - ret = clk_reset(link_clk, CLK_RESET_ASSERT); 69 - if (ret) 70 - pr_err("usb hs_clk assert failed\n"); 71 - } else { 72 - ret = clk_reset(link_clk, CLK_RESET_DEASSERT); 73 - if (ret) 74 - pr_err("usb hs_clk deassert failed\n"); 75 - } 76 - return ret; 77 - } 78 - 79 - static int hsusb_phy_clk_reset(struct clk *phy_clk) 80 - { 81 - int ret; 82 - 83 - ret = clk_reset(phy_clk, CLK_RESET_ASSERT); 84 - if (ret) { 85 - pr_err("usb phy clk assert failed\n"); 86 - return ret; 87 - } 88 - usleep_range(10000, 12000); 89 - ret = clk_reset(phy_clk, CLK_RESET_DEASSERT); 90 - if (ret) 91 - pr_err("usb phy clk deassert failed\n"); 92 - return ret; 93 - } 94 - 95 - static struct msm_otg_platform_data msm_otg_pdata = { 96 - .phy_init_seq = hsusb_phy_init_seq, 97 - .mode = USB_DR_MODE_PERIPHERAL, 98 - .otg_control = OTG_PHY_CONTROL, 99 - .link_clk_reset = hsusb_link_clk_reset, 100 - .phy_clk_reset = hsusb_phy_clk_reset, 101 - }; 102 - 103 - struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = { 104 - #ifdef CONFIG_SERIAL_MSM_CONSOLE 105 - [49] = { /* UART2 RFR */ 106 - .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN | 107 - GPIOMUX_FUNC_2 | GPIOMUX_VALID, 108 - }, 109 - [50] = { /* UART2 CTS */ 110 - .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN | 111 - GPIOMUX_FUNC_2 | GPIOMUX_VALID, 112 - }, 113 - [51] = { /* UART2 RX */ 114 - .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN | 115 - GPIOMUX_FUNC_2 | GPIOMUX_VALID, 116 - }, 117 - [52] = { /* UART2 TX */ 118 - .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN | 119 - GPIOMUX_FUNC_2 | GPIOMUX_VALID, 120 - }, 121 - #endif 122 - }; 123 - 124 - static struct platform_device *devices[] __initdata = { 125 - &msm_clock_7x30, 126 - &msm_device_gpio_7x30, 127 - #if defined(CONFIG_SERIAL_MSM) 128 - &msm_device_uart2, 129 - #endif 130 - &msm_device_smd, 131 - &msm_device_otg, 132 - &msm_device_hsusb, 133 - &msm_device_hsusb_host, 134 - }; 135 - 136 - static void __init msm7x30_init_irq(void) 137 - { 138 - msm_init_irq(); 139 - } 140 - 141 - static void __init msm7x30_init(void) 142 - { 143 - msm_device_otg.dev.platform_data = &msm_otg_pdata; 144 - msm_device_hsusb.dev.parent = &msm_device_otg.dev; 145 - msm_device_hsusb_host.dev.parent = &msm_device_otg.dev; 146 - 147 - platform_add_devices(devices, ARRAY_SIZE(devices)); 148 - } 149 - 150 - static void __init msm7x30_map_io(void) 151 - { 152 - msm_map_msm7x30_io(); 153 - } 154 - 155 - static void __init msm7x30_init_late(void) 156 - { 157 - smd_debugfs_init(); 158 - } 159 - 160 - MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF") 161 - .atag_offset = 0x100, 162 - .fixup = msm7x30_fixup, 163 - .reserve = msm7x30_reserve, 164 - .map_io = msm7x30_map_io, 165 - .init_irq = msm7x30_init_irq, 166 - .init_machine = msm7x30_init, 167 - .init_late = msm7x30_init_late, 168 - .init_time = msm7x30_timer_init, 169 - MACHINE_END 170 - 171 - MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA") 172 - .atag_offset = 0x100, 173 - .fixup = msm7x30_fixup, 174 - .reserve = msm7x30_reserve, 175 - .map_io = msm7x30_map_io, 176 - .init_irq = msm7x30_init_irq, 177 - .init_machine = msm7x30_init, 178 - .init_late = msm7x30_init_late, 179 - .init_time = msm7x30_timer_init, 180 - MACHINE_END 181 - 182 - MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID") 183 - .atag_offset = 0x100, 184 - .fixup = msm7x30_fixup, 185 - .reserve = msm7x30_reserve, 186 - .map_io = msm7x30_map_io, 187 - .init_irq = msm7x30_init_irq, 188 - .init_machine = msm7x30_init, 189 - .init_late = msm7x30_init_late, 190 - .init_time = msm7x30_timer_init, 191 - MACHINE_END
-254
arch/arm/mach-msm/board-qsd8x50.c
··· 1 - /* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 - * 02110-1301, USA. 16 - */ 17 - #include <linux/gpio.h> 18 - #include <linux/kernel.h> 19 - #include <linux/irq.h> 20 - #include <linux/platform_device.h> 21 - #include <linux/delay.h> 22 - #include <linux/usb/msm_hsusb.h> 23 - #include <linux/err.h> 24 - #include <linux/clkdev.h> 25 - #include <linux/smc91x.h> 26 - 27 - #include <asm/mach-types.h> 28 - #include <asm/mach/arch.h> 29 - #include <asm/io.h> 30 - #include <asm/setup.h> 31 - 32 - #include <mach/irqs.h> 33 - #include <mach/sirc.h> 34 - #include <mach/vreg.h> 35 - #include <mach/clk.h> 36 - #include <linux/platform_data/mmc-msm_sdcc.h> 37 - 38 - #include "devices.h" 39 - #include "common.h" 40 - 41 - static const resource_size_t qsd8x50_surf_smc91x_base __initconst = 0x70000300; 42 - static const unsigned qsd8x50_surf_smc91x_gpio __initconst = 156; 43 - 44 - /* Leave smc91x resources empty here, as we'll fill them in 45 - * at run-time: they vary from board to board, and the true 46 - * configuration won't be known until boot. 47 - */ 48 - static struct resource smc91x_resources[] = { 49 - [0] = { 50 - .flags = IORESOURCE_MEM, 51 - }, 52 - [1] = { 53 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 54 - }, 55 - }; 56 - 57 - static struct smc91x_platdata smc91x_platdata = { 58 - .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 59 - }; 60 - 61 - static struct platform_device smc91x_device = { 62 - .name = "smc91x", 63 - .id = 0, 64 - .num_resources = ARRAY_SIZE(smc91x_resources), 65 - .resource = smc91x_resources, 66 - .dev.platform_data = &smc91x_platdata, 67 - }; 68 - 69 - static int __init msm_init_smc91x(void) 70 - { 71 - if (machine_is_qsd8x50_surf()) { 72 - smc91x_resources[0].start = qsd8x50_surf_smc91x_base; 73 - smc91x_resources[0].end = qsd8x50_surf_smc91x_base + 0xff; 74 - smc91x_resources[1].start = 75 - gpio_to_irq(qsd8x50_surf_smc91x_gpio); 76 - smc91x_resources[1].end = 77 - gpio_to_irq(qsd8x50_surf_smc91x_gpio); 78 - platform_device_register(&smc91x_device); 79 - } 80 - 81 - return 0; 82 - } 83 - module_init(msm_init_smc91x); 84 - 85 - static int hsusb_phy_init_seq[] = { 86 - 0x08, 0x31, /* Increase HS Driver Amplitude */ 87 - 0x20, 0x32, /* Enable and set Pre-Emphasis Depth to 10% */ 88 - -1 89 - }; 90 - 91 - static int hsusb_link_clk_reset(struct clk *link_clk, bool assert) 92 - { 93 - int ret; 94 - 95 - if (assert) { 96 - ret = clk_reset(link_clk, CLK_RESET_ASSERT); 97 - if (ret) 98 - pr_err("usb hs_clk assert failed\n"); 99 - } else { 100 - ret = clk_reset(link_clk, CLK_RESET_DEASSERT); 101 - if (ret) 102 - pr_err("usb hs_clk deassert failed\n"); 103 - } 104 - return ret; 105 - } 106 - 107 - static int hsusb_phy_clk_reset(struct clk *phy_clk) 108 - { 109 - int ret; 110 - 111 - ret = clk_reset(phy_clk, CLK_RESET_ASSERT); 112 - if (ret) { 113 - pr_err("usb phy clk assert failed\n"); 114 - return ret; 115 - } 116 - usleep_range(10000, 12000); 117 - ret = clk_reset(phy_clk, CLK_RESET_DEASSERT); 118 - if (ret) 119 - pr_err("usb phy clk deassert failed\n"); 120 - return ret; 121 - } 122 - 123 - static struct msm_otg_platform_data msm_otg_pdata = { 124 - .phy_init_seq = hsusb_phy_init_seq, 125 - .mode = USB_DR_MODE_PERIPHERAL, 126 - .otg_control = OTG_PHY_CONTROL, 127 - .link_clk_reset = hsusb_link_clk_reset, 128 - .phy_clk_reset = hsusb_phy_clk_reset, 129 - }; 130 - 131 - static struct platform_device *devices[] __initdata = { 132 - &msm_clock_8x50, 133 - &msm_device_gpio_8x50, 134 - &msm_device_uart3, 135 - &msm_device_smd, 136 - &msm_device_otg, 137 - &msm_device_hsusb, 138 - &msm_device_hsusb_host, 139 - }; 140 - 141 - static struct msm_mmc_gpio sdc1_gpio_cfg[] = { 142 - {51, "sdc1_dat_3"}, 143 - {52, "sdc1_dat_2"}, 144 - {53, "sdc1_dat_1"}, 145 - {54, "sdc1_dat_0"}, 146 - {55, "sdc1_cmd"}, 147 - {56, "sdc1_clk"} 148 - }; 149 - 150 - static struct vreg *vreg_mmc; 151 - static unsigned long vreg_sts; 152 - 153 - static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd) 154 - { 155 - int rc = 0; 156 - struct platform_device *pdev; 157 - 158 - pdev = container_of(dv, struct platform_device, dev); 159 - 160 - if (vdd == 0) { 161 - if (!vreg_sts) 162 - return 0; 163 - 164 - clear_bit(pdev->id, &vreg_sts); 165 - 166 - if (!vreg_sts) { 167 - rc = vreg_disable(vreg_mmc); 168 - if (rc) 169 - pr_err("vreg_mmc disable failed for slot " 170 - "%d: %d\n", pdev->id, rc); 171 - } 172 - return 0; 173 - } 174 - 175 - if (!vreg_sts) { 176 - rc = vreg_set_level(vreg_mmc, 2900); 177 - if (rc) 178 - pr_err("vreg_mmc set level failed for slot %d: %d\n", 179 - pdev->id, rc); 180 - rc = vreg_enable(vreg_mmc); 181 - if (rc) 182 - pr_err("vreg_mmc enable failed for slot %d: %d\n", 183 - pdev->id, rc); 184 - } 185 - set_bit(pdev->id, &vreg_sts); 186 - return 0; 187 - } 188 - 189 - static struct msm_mmc_gpio_data sdc1_gpio = { 190 - .gpio = sdc1_gpio_cfg, 191 - .size = ARRAY_SIZE(sdc1_gpio_cfg), 192 - }; 193 - 194 - static struct msm_mmc_platform_data qsd8x50_sdc1_data = { 195 - .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 196 - .translate_vdd = msm_sdcc_setup_power, 197 - .gpio_data = &sdc1_gpio, 198 - }; 199 - 200 - static void __init qsd8x50_init_mmc(void) 201 - { 202 - vreg_mmc = vreg_get(NULL, "gp5"); 203 - 204 - if (IS_ERR(vreg_mmc)) { 205 - pr_err("vreg get for vreg_mmc failed (%ld)\n", 206 - PTR_ERR(vreg_mmc)); 207 - return; 208 - } 209 - 210 - msm_add_sdcc(1, &qsd8x50_sdc1_data, 0, 0); 211 - } 212 - 213 - static void __init qsd8x50_map_io(void) 214 - { 215 - msm_map_qsd8x50_io(); 216 - } 217 - 218 - static void __init qsd8x50_init_irq(void) 219 - { 220 - msm_init_irq(); 221 - msm_init_sirc(); 222 - } 223 - 224 - static void __init qsd8x50_init(void) 225 - { 226 - msm_device_otg.dev.platform_data = &msm_otg_pdata; 227 - msm_device_hsusb.dev.parent = &msm_device_otg.dev; 228 - msm_device_hsusb_host.dev.parent = &msm_device_otg.dev; 229 - platform_add_devices(devices, ARRAY_SIZE(devices)); 230 - qsd8x50_init_mmc(); 231 - } 232 - 233 - static void __init qsd8x50_init_late(void) 234 - { 235 - smd_debugfs_init(); 236 - } 237 - 238 - MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF") 239 - .atag_offset = 0x100, 240 - .map_io = qsd8x50_map_io, 241 - .init_irq = qsd8x50_init_irq, 242 - .init_machine = qsd8x50_init, 243 - .init_late = qsd8x50_init_late, 244 - .init_time = qsd8x50_timer_init, 245 - MACHINE_END 246 - 247 - MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5") 248 - .atag_offset = 0x100, 249 - .map_io = qsd8x50_map_io, 250 - .init_irq = qsd8x50_init_irq, 251 - .init_machine = qsd8x50_init, 252 - .init_late = qsd8x50_init_late, 253 - .init_time = qsd8x50_timer_init, 254 - MACHINE_END
-114
arch/arm/mach-msm/board-sapphire.c
··· 1 - /* linux/arch/arm/mach-msm/board-sapphire.c 2 - * Copyright (C) 2007-2009 HTC Corporation. 3 - * Author: Thomas Tsai <thomas_tsai@htc.com> 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - */ 14 - #include <linux/gpio.h> 15 - #include <linux/kernel.h> 16 - #include <linux/init.h> 17 - #include <linux/platform_device.h> 18 - #include <linux/input.h> 19 - #include <linux/interrupt.h> 20 - #include <linux/irq.h> 21 - #include <linux/device.h> 22 - 23 - #include <linux/delay.h> 24 - 25 - #include <mach/hardware.h> 26 - #include <asm/mach-types.h> 27 - #include <asm/mach/arch.h> 28 - #include <asm/mach/map.h> 29 - #include <asm/mach/flash.h> 30 - #include <mach/vreg.h> 31 - 32 - #include <asm/io.h> 33 - #include <asm/delay.h> 34 - #include <asm/setup.h> 35 - 36 - #include <linux/mtd/nand.h> 37 - #include <linux/mtd/partitions.h> 38 - #include <linux/memblock.h> 39 - 40 - #include "gpio_chip.h" 41 - #include "board-sapphire.h" 42 - #include "proc_comm.h" 43 - #include "devices.h" 44 - #include "common.h" 45 - 46 - void msm_init_irq(void); 47 - void msm_init_gpio(void); 48 - 49 - static struct platform_device *devices[] __initdata = { 50 - &msm_device_smd, 51 - &msm_device_dmov, 52 - &msm_device_nand, 53 - &msm_device_uart1, 54 - &msm_device_uart3, 55 - }; 56 - 57 - void msm_timer_init(void); 58 - 59 - static void __init sapphire_init_irq(void) 60 - { 61 - msm_init_irq(); 62 - } 63 - 64 - static void __init sapphire_init(void) 65 - { 66 - platform_add_devices(devices, ARRAY_SIZE(devices)); 67 - } 68 - 69 - static struct map_desc sapphire_io_desc[] __initdata = { 70 - { 71 - .virtual = SAPPHIRE_CPLD_BASE, 72 - .pfn = __phys_to_pfn(SAPPHIRE_CPLD_START), 73 - .length = SAPPHIRE_CPLD_SIZE, 74 - .type = MT_DEVICE_NONSHARED 75 - } 76 - }; 77 - 78 - static void __init sapphire_fixup(struct tag *tags, char **cmdline) 79 - { 80 - int smi_sz = parse_tag_smi((const struct tag *)tags); 81 - 82 - if (smi_sz == 32) { 83 - memblock_add(PHYS_OFFSET, 84*SZ_1M); 84 - } else if (smi_sz == 64) { 85 - memblock_add(PHYS_OFFSET, 101*SZ_1M); 86 - } else { 87 - memblock_add(PHYS_OFFSET, 101*SZ_1M); 88 - /* Give a default value when not get smi size */ 89 - smi_sz = 64; 90 - } 91 - } 92 - 93 - static void __init sapphire_map_io(void) 94 - { 95 - msm_map_common_io(); 96 - iotable_init(sapphire_io_desc, ARRAY_SIZE(sapphire_io_desc)); 97 - msm_clock_init(); 98 - } 99 - 100 - static void __init sapphire_init_late(void) 101 - { 102 - smd_debugfs_init(); 103 - } 104 - 105 - MACHINE_START(SAPPHIRE, "sapphire") 106 - /* Maintainer: Brian Swetland <swetland@google.com> */ 107 - .atag_offset = 0x100, 108 - .fixup = sapphire_fixup, 109 - .map_io = sapphire_map_io, 110 - .init_irq = sapphire_init_irq, 111 - .init_machine = sapphire_init, 112 - .init_late = sapphire_init_late, 113 - .init_time = msm_timer_init, 114 - MACHINE_END
-233
arch/arm/mach-msm/board-trout-gpio.c
··· 1 - /* 2 - * linux/arch/arm/mach-msm/gpio.c 3 - * 4 - * Copyright (C) 2005 HP Labs 5 - * Copyright (C) 2008 Google, Inc. 6 - * Copyright (C) 2009 Pavel Machek <pavel@ucw.cz> 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 - */ 13 - 14 - #include <linux/kernel.h> 15 - #include <linux/module.h> 16 - #include <linux/io.h> 17 - #include <linux/irq.h> 18 - #include <linux/interrupt.h> 19 - #include <linux/gpio.h> 20 - 21 - #include "board-trout.h" 22 - 23 - static uint8_t trout_int_mask[2] = { 24 - [0] = 0xff, /* mask all interrupts */ 25 - [1] = 0xff, 26 - }; 27 - static uint8_t trout_sleep_int_mask[] = { 28 - [0] = 0xff, 29 - [1] = 0xff, 30 - }; 31 - 32 - struct msm_gpio_chip { 33 - struct gpio_chip chip; 34 - void __iomem *reg; /* Base of register bank */ 35 - u8 shadow; 36 - }; 37 - 38 - #define to_msm_gpio_chip(c) container_of(c, struct msm_gpio_chip, chip) 39 - 40 - static int msm_gpiolib_get(struct gpio_chip *chip, unsigned offset) 41 - { 42 - struct msm_gpio_chip *msm_gpio = to_msm_gpio_chip(chip); 43 - unsigned mask = 1 << offset; 44 - 45 - return !!(readb(msm_gpio->reg) & mask); 46 - } 47 - 48 - static void msm_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val) 49 - { 50 - struct msm_gpio_chip *msm_gpio = to_msm_gpio_chip(chip); 51 - unsigned mask = 1 << offset; 52 - 53 - if (val) 54 - msm_gpio->shadow |= mask; 55 - else 56 - msm_gpio->shadow &= ~mask; 57 - 58 - writeb(msm_gpio->shadow, msm_gpio->reg); 59 - } 60 - 61 - static int msm_gpiolib_direction_input(struct gpio_chip *chip, 62 - unsigned offset) 63 - { 64 - msm_gpiolib_set(chip, offset, 0); 65 - return 0; 66 - } 67 - 68 - static int msm_gpiolib_direction_output(struct gpio_chip *chip, 69 - unsigned offset, int val) 70 - { 71 - msm_gpiolib_set(chip, offset, val); 72 - return 0; 73 - } 74 - 75 - static int trout_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 76 - { 77 - return TROUT_GPIO_TO_INT(offset + chip->base); 78 - } 79 - 80 - #define TROUT_GPIO_BANK(name, reg_num, base_gpio, shadow_val) \ 81 - { \ 82 - .chip = { \ 83 - .label = name, \ 84 - .direction_input = msm_gpiolib_direction_input,\ 85 - .direction_output = msm_gpiolib_direction_output, \ 86 - .get = msm_gpiolib_get, \ 87 - .set = msm_gpiolib_set, \ 88 - .to_irq = trout_gpio_to_irq, \ 89 - .base = base_gpio, \ 90 - .ngpio = 8, \ 91 - }, \ 92 - .reg = reg_num + TROUT_CPLD_BASE, \ 93 - .shadow = shadow_val, \ 94 - } 95 - 96 - static struct msm_gpio_chip msm_gpio_banks[] = { 97 - #if defined(CONFIG_DEBUG_MSM_UART) && (CONFIG_DEBUG_UART_PHYS == 0xa9a00000) 98 - /* H2W pins <-> UART1 */ 99 - TROUT_GPIO_BANK("MISC2", 0x00, TROUT_GPIO_MISC2_BASE, 0x40), 100 - #else 101 - /* H2W pins <-> UART3, Bluetooth <-> UART1 */ 102 - TROUT_GPIO_BANK("MISC2", 0x00, TROUT_GPIO_MISC2_BASE, 0x80), 103 - #endif 104 - /* I2C pull */ 105 - TROUT_GPIO_BANK("MISC3", 0x02, TROUT_GPIO_MISC3_BASE, 0x04), 106 - TROUT_GPIO_BANK("MISC4", 0x04, TROUT_GPIO_MISC4_BASE, 0), 107 - /* mmdi 32k en */ 108 - TROUT_GPIO_BANK("MISC5", 0x06, TROUT_GPIO_MISC5_BASE, 0x04), 109 - TROUT_GPIO_BANK("INT2", 0x08, TROUT_GPIO_INT2_BASE, 0), 110 - TROUT_GPIO_BANK("MISC1", 0x0a, TROUT_GPIO_MISC1_BASE, 0), 111 - TROUT_GPIO_BANK("VIRTUAL", 0x12, TROUT_GPIO_VIRTUAL_BASE, 0), 112 - }; 113 - 114 - static void trout_gpio_irq_ack(struct irq_data *d) 115 - { 116 - int bank = TROUT_INT_TO_BANK(d->irq); 117 - uint8_t mask = TROUT_INT_TO_MASK(d->irq); 118 - int reg = TROUT_BANK_TO_STAT_REG(bank); 119 - /*printk(KERN_INFO "trout_gpio_irq_ack irq %d\n", d->irq);*/ 120 - writeb(mask, TROUT_CPLD_BASE + reg); 121 - } 122 - 123 - static void trout_gpio_irq_mask(struct irq_data *d) 124 - { 125 - unsigned long flags; 126 - uint8_t reg_val; 127 - int bank = TROUT_INT_TO_BANK(d->irq); 128 - uint8_t mask = TROUT_INT_TO_MASK(d->irq); 129 - int reg = TROUT_BANK_TO_MASK_REG(bank); 130 - 131 - local_irq_save(flags); 132 - reg_val = trout_int_mask[bank] |= mask; 133 - /*printk(KERN_INFO "trout_gpio_irq_mask irq %d => %d:%02x\n", 134 - d->irq, bank, reg_val);*/ 135 - writeb(reg_val, TROUT_CPLD_BASE + reg); 136 - local_irq_restore(flags); 137 - } 138 - 139 - static void trout_gpio_irq_unmask(struct irq_data *d) 140 - { 141 - unsigned long flags; 142 - uint8_t reg_val; 143 - int bank = TROUT_INT_TO_BANK(d->irq); 144 - uint8_t mask = TROUT_INT_TO_MASK(d->irq); 145 - int reg = TROUT_BANK_TO_MASK_REG(bank); 146 - 147 - local_irq_save(flags); 148 - reg_val = trout_int_mask[bank] &= ~mask; 149 - /*printk(KERN_INFO "trout_gpio_irq_unmask irq %d => %d:%02x\n", 150 - d->irq, bank, reg_val);*/ 151 - writeb(reg_val, TROUT_CPLD_BASE + reg); 152 - local_irq_restore(flags); 153 - } 154 - 155 - int trout_gpio_irq_set_wake(struct irq_data *d, unsigned int on) 156 - { 157 - unsigned long flags; 158 - int bank = TROUT_INT_TO_BANK(d->irq); 159 - uint8_t mask = TROUT_INT_TO_MASK(d->irq); 160 - 161 - local_irq_save(flags); 162 - if(on) 163 - trout_sleep_int_mask[bank] &= ~mask; 164 - else 165 - trout_sleep_int_mask[bank] |= mask; 166 - local_irq_restore(flags); 167 - return 0; 168 - } 169 - 170 - static void trout_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 171 - { 172 - int j, m; 173 - unsigned v; 174 - int bank; 175 - int stat_reg; 176 - int int_base = TROUT_INT_START; 177 - uint8_t int_mask; 178 - 179 - for (bank = 0; bank < 2; bank++) { 180 - stat_reg = TROUT_BANK_TO_STAT_REG(bank); 181 - v = readb(TROUT_CPLD_BASE + stat_reg); 182 - int_mask = trout_int_mask[bank]; 183 - if (v & int_mask) { 184 - writeb(v & int_mask, TROUT_CPLD_BASE + stat_reg); 185 - printk(KERN_ERR "trout_gpio_irq_handler: got masked " 186 - "interrupt: %d:%02x\n", bank, v & int_mask); 187 - } 188 - v &= ~int_mask; 189 - while (v) { 190 - m = v & -v; 191 - j = fls(m) - 1; 192 - /*printk(KERN_INFO "msm_gpio_irq_handler %d:%02x %02x b" 193 - "it %d irq %d\n", bank, v, m, j, int_base + j);*/ 194 - v &= ~m; 195 - generic_handle_irq(int_base + j); 196 - } 197 - int_base += TROUT_INT_BANK0_COUNT; 198 - } 199 - desc->irq_data.chip->irq_ack(&desc->irq_data); 200 - } 201 - 202 - static struct irq_chip trout_gpio_irq_chip = { 203 - .name = "troutgpio", 204 - .irq_ack = trout_gpio_irq_ack, 205 - .irq_mask = trout_gpio_irq_mask, 206 - .irq_unmask = trout_gpio_irq_unmask, 207 - .irq_set_wake = trout_gpio_irq_set_wake, 208 - }; 209 - 210 - /* 211 - * Called from the processor-specific init to enable GPIO pin support. 212 - */ 213 - int __init trout_init_gpio(void) 214 - { 215 - int i; 216 - for(i = TROUT_INT_START; i <= TROUT_INT_END; i++) { 217 - irq_set_chip_and_handler(i, &trout_gpio_irq_chip, 218 - handle_edge_irq); 219 - set_irq_flags(i, IRQF_VALID); 220 - } 221 - 222 - for (i = 0; i < ARRAY_SIZE(msm_gpio_banks); i++) 223 - gpiochip_add(&msm_gpio_banks[i].chip); 224 - 225 - irq_set_irq_type(MSM_GPIO_TO_INT(17), IRQF_TRIGGER_HIGH); 226 - irq_set_chained_handler(MSM_GPIO_TO_INT(17), trout_gpio_irq_handler); 227 - irq_set_irq_wake(MSM_GPIO_TO_INT(17), 1); 228 - 229 - return 0; 230 - } 231 - 232 - postcore_initcall(trout_init_gpio); 233 -
-185
arch/arm/mach-msm/board-trout-mmc.c
··· 1 - /* linux/arch/arm/mach-msm/board-trout-mmc.c 2 - ** Author: Brian Swetland <swetland@google.com> 3 - */ 4 - #include <linux/gpio.h> 5 - #include <linux/kernel.h> 6 - #include <linux/init.h> 7 - #include <linux/platform_device.h> 8 - #include <linux/delay.h> 9 - #include <linux/mmc/host.h> 10 - #include <linux/mmc/sdio_ids.h> 11 - #include <linux/err.h> 12 - #include <linux/debugfs.h> 13 - 14 - #include <asm/io.h> 15 - 16 - #include <mach/vreg.h> 17 - 18 - #include <linux/platform_data/mmc-msm_sdcc.h> 19 - 20 - #include "devices.h" 21 - 22 - #include "board-trout.h" 23 - 24 - #include "proc_comm.h" 25 - 26 - #define DEBUG_SDSLOT_VDD 1 27 - 28 - /* ---- COMMON ---- */ 29 - static void config_gpio_table(uint32_t *table, int len) 30 - { 31 - int n; 32 - unsigned id; 33 - for(n = 0; n < len; n++) { 34 - id = table[n]; 35 - msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0); 36 - } 37 - } 38 - 39 - /* ---- SDCARD ---- */ 40 - 41 - static uint32_t sdcard_on_gpio_table[] = { 42 - PCOM_GPIO_CFG(62, 2, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */ 43 - PCOM_GPIO_CFG(63, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* CMD */ 44 - PCOM_GPIO_CFG(64, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* DAT3 */ 45 - PCOM_GPIO_CFG(65, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* DAT2 */ 46 - PCOM_GPIO_CFG(66, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT1 */ 47 - PCOM_GPIO_CFG(67, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT0 */ 48 - }; 49 - 50 - static uint32_t sdcard_off_gpio_table[] = { 51 - PCOM_GPIO_CFG(62, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CLK */ 52 - PCOM_GPIO_CFG(63, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CMD */ 53 - PCOM_GPIO_CFG(64, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT3 */ 54 - PCOM_GPIO_CFG(65, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT2 */ 55 - PCOM_GPIO_CFG(66, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT1 */ 56 - PCOM_GPIO_CFG(67, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT0 */ 57 - }; 58 - 59 - static uint opt_disable_sdcard; 60 - 61 - static int __init trout_disablesdcard_setup(char *str) 62 - { 63 - int cal = simple_strtol(str, NULL, 0); 64 - 65 - opt_disable_sdcard = cal; 66 - return 1; 67 - } 68 - 69 - __setup("board_trout.disable_sdcard=", trout_disablesdcard_setup); 70 - 71 - static struct vreg *vreg_sdslot; /* SD slot power */ 72 - 73 - struct mmc_vdd_xlat { 74 - int mask; 75 - int level; 76 - }; 77 - 78 - static struct mmc_vdd_xlat mmc_vdd_table[] = { 79 - { MMC_VDD_165_195, 1800 }, 80 - { MMC_VDD_20_21, 2050 }, 81 - { MMC_VDD_21_22, 2150 }, 82 - { MMC_VDD_22_23, 2250 }, 83 - { MMC_VDD_23_24, 2350 }, 84 - { MMC_VDD_24_25, 2450 }, 85 - { MMC_VDD_25_26, 2550 }, 86 - { MMC_VDD_26_27, 2650 }, 87 - { MMC_VDD_27_28, 2750 }, 88 - { MMC_VDD_28_29, 2850 }, 89 - { MMC_VDD_29_30, 2950 }, 90 - }; 91 - 92 - static unsigned int sdslot_vdd = 0xffffffff; 93 - static unsigned int sdslot_vreg_enabled; 94 - 95 - static uint32_t trout_sdslot_switchvdd(struct device *dev, unsigned int vdd) 96 - { 97 - int i, rc; 98 - 99 - BUG_ON(!vreg_sdslot); 100 - 101 - if (vdd == sdslot_vdd) 102 - return 0; 103 - 104 - sdslot_vdd = vdd; 105 - 106 - if (vdd == 0) { 107 - #if DEBUG_SDSLOT_VDD 108 - printk("%s: Disabling SD slot power\n", __func__); 109 - #endif 110 - config_gpio_table(sdcard_off_gpio_table, 111 - ARRAY_SIZE(sdcard_off_gpio_table)); 112 - vreg_disable(vreg_sdslot); 113 - sdslot_vreg_enabled = 0; 114 - return 0; 115 - } 116 - 117 - if (!sdslot_vreg_enabled) { 118 - rc = vreg_enable(vreg_sdslot); 119 - if (rc) { 120 - printk(KERN_ERR "%s: Error enabling vreg (%d)\n", 121 - __func__, rc); 122 - } 123 - config_gpio_table(sdcard_on_gpio_table, 124 - ARRAY_SIZE(sdcard_on_gpio_table)); 125 - sdslot_vreg_enabled = 1; 126 - } 127 - 128 - for (i = 0; i < ARRAY_SIZE(mmc_vdd_table); i++) { 129 - if (mmc_vdd_table[i].mask == (1 << vdd)) { 130 - #if DEBUG_SDSLOT_VDD 131 - printk("%s: Setting level to %u\n", 132 - __func__, mmc_vdd_table[i].level); 133 - #endif 134 - rc = vreg_set_level(vreg_sdslot, 135 - mmc_vdd_table[i].level); 136 - if (rc) { 137 - printk(KERN_ERR 138 - "%s: Error setting vreg level (%d)\n", 139 - __func__, rc); 140 - } 141 - return 0; 142 - } 143 - } 144 - 145 - printk(KERN_ERR "%s: Invalid VDD %d specified\n", __func__, vdd); 146 - return 0; 147 - } 148 - 149 - static unsigned int trout_sdslot_status(struct device *dev) 150 - { 151 - unsigned int status; 152 - 153 - status = (unsigned int) gpio_get_value(TROUT_GPIO_SDMC_CD_N); 154 - return (!status); 155 - } 156 - 157 - #define TROUT_MMC_VDD MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_21_22 \ 158 - | MMC_VDD_22_23 | MMC_VDD_23_24 | MMC_VDD_24_25 \ 159 - | MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 \ 160 - | MMC_VDD_28_29 | MMC_VDD_29_30 161 - 162 - static struct msm_mmc_platform_data trout_sdslot_data = { 163 - .ocr_mask = TROUT_MMC_VDD, 164 - .status = trout_sdslot_status, 165 - .translate_vdd = trout_sdslot_switchvdd, 166 - }; 167 - 168 - int __init trout_init_mmc(unsigned int sys_rev) 169 - { 170 - sdslot_vreg_enabled = 0; 171 - 172 - vreg_sdslot = vreg_get(0, "gp6"); 173 - if (IS_ERR(vreg_sdslot)) 174 - return PTR_ERR(vreg_sdslot); 175 - 176 - irq_set_irq_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 1); 177 - 178 - if (!opt_disable_sdcard) 179 - msm_add_sdcc(2, &trout_sdslot_data, 180 - TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 0); 181 - else 182 - printk(KERN_INFO "trout: SD-Card interface disabled\n"); 183 - return 0; 184 - } 185 -
-292
arch/arm/mach-msm/board-trout-panel.c
··· 1 - /* linux/arch/arm/mach-msm/board-trout-mddi.c 2 - ** Author: Brian Swetland <swetland@google.com> 3 - */ 4 - #include <linux/gpio.h> 5 - #include <linux/kernel.h> 6 - #include <linux/init.h> 7 - #include <linux/platform_device.h> 8 - #include <linux/delay.h> 9 - #include <linux/leds.h> 10 - #include <linux/err.h> 11 - 12 - #include <asm/io.h> 13 - #include <asm/mach-types.h> 14 - #include <asm/system_info.h> 15 - 16 - #include <linux/platform_data/video-msm_fb.h> 17 - #include <mach/vreg.h> 18 - 19 - #include "board-trout.h" 20 - #include "proc_comm.h" 21 - #include "clock-pcom.h" 22 - #include "devices.h" 23 - 24 - #define TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS 255 25 - 26 - #define MDDI_CLIENT_CORE_BASE 0x108000 27 - #define LCD_CONTROL_BLOCK_BASE 0x110000 28 - #define SPI_BLOCK_BASE 0x120000 29 - #define I2C_BLOCK_BASE 0x130000 30 - #define PWM_BLOCK_BASE 0x140000 31 - #define GPIO_BLOCK_BASE 0x150000 32 - #define SYSTEM_BLOCK1_BASE 0x160000 33 - #define SYSTEM_BLOCK2_BASE 0x170000 34 - 35 - 36 - #define DPSUS (MDDI_CLIENT_CORE_BASE|0x24) 37 - #define SYSCLKENA (MDDI_CLIENT_CORE_BASE|0x2C) 38 - #define PWM0OFF (PWM_BLOCK_BASE|0x1C) 39 - 40 - #define V_VDDE2E_VDD2_GPIO 0 41 - #define MDDI_RST_N 82 42 - 43 - #define MDDICAP0 (MDDI_CLIENT_CORE_BASE|0x00) 44 - #define MDDICAP1 (MDDI_CLIENT_CORE_BASE|0x04) 45 - #define MDDICAP2 (MDDI_CLIENT_CORE_BASE|0x08) 46 - #define MDDICAP3 (MDDI_CLIENT_CORE_BASE|0x0C) 47 - #define MDCAPCHG (MDDI_CLIENT_CORE_BASE|0x10) 48 - #define MDCRCERC (MDDI_CLIENT_CORE_BASE|0x14) 49 - #define TTBUSSEL (MDDI_CLIENT_CORE_BASE|0x18) 50 - #define DPSET0 (MDDI_CLIENT_CORE_BASE|0x1C) 51 - #define DPSET1 (MDDI_CLIENT_CORE_BASE|0x20) 52 - #define DPSUS (MDDI_CLIENT_CORE_BASE|0x24) 53 - #define DPRUN (MDDI_CLIENT_CORE_BASE|0x28) 54 - #define SYSCKENA (MDDI_CLIENT_CORE_BASE|0x2C) 55 - #define TESTMODE (MDDI_CLIENT_CORE_BASE|0x30) 56 - #define FIFOMONI (MDDI_CLIENT_CORE_BASE|0x34) 57 - #define INTMONI (MDDI_CLIENT_CORE_BASE|0x38) 58 - #define MDIOBIST (MDDI_CLIENT_CORE_BASE|0x3C) 59 - #define MDIOPSET (MDDI_CLIENT_CORE_BASE|0x40) 60 - #define BITMAP0 (MDDI_CLIENT_CORE_BASE|0x44) 61 - #define BITMAP1 (MDDI_CLIENT_CORE_BASE|0x48) 62 - #define BITMAP2 (MDDI_CLIENT_CORE_BASE|0x4C) 63 - #define BITMAP3 (MDDI_CLIENT_CORE_BASE|0x50) 64 - #define BITMAP4 (MDDI_CLIENT_CORE_BASE|0x54) 65 - 66 - #define SRST (LCD_CONTROL_BLOCK_BASE|0x00) 67 - #define PORT_ENB (LCD_CONTROL_BLOCK_BASE|0x04) 68 - #define START (LCD_CONTROL_BLOCK_BASE|0x08) 69 - #define PORT (LCD_CONTROL_BLOCK_BASE|0x0C) 70 - #define CMN (LCD_CONTROL_BLOCK_BASE|0x10) 71 - #define GAMMA (LCD_CONTROL_BLOCK_BASE|0x14) 72 - #define INTFLG (LCD_CONTROL_BLOCK_BASE|0x18) 73 - #define INTMSK (LCD_CONTROL_BLOCK_BASE|0x1C) 74 - #define MPLFBUF (LCD_CONTROL_BLOCK_BASE|0x20) 75 - #define HDE_LEFT (LCD_CONTROL_BLOCK_BASE|0x24) 76 - #define VDE_TOP (LCD_CONTROL_BLOCK_BASE|0x28) 77 - #define PXL (LCD_CONTROL_BLOCK_BASE|0x30) 78 - #define HCYCLE (LCD_CONTROL_BLOCK_BASE|0x34) 79 - #define HSW (LCD_CONTROL_BLOCK_BASE|0x38) 80 - #define HDE_START (LCD_CONTROL_BLOCK_BASE|0x3C) 81 - #define HDE_SIZE (LCD_CONTROL_BLOCK_BASE|0x40) 82 - #define VCYCLE (LCD_CONTROL_BLOCK_BASE|0x44) 83 - #define VSW (LCD_CONTROL_BLOCK_BASE|0x48) 84 - #define VDE_START (LCD_CONTROL_BLOCK_BASE|0x4C) 85 - #define VDE_SIZE (LCD_CONTROL_BLOCK_BASE|0x50) 86 - #define WAKEUP (LCD_CONTROL_BLOCK_BASE|0x54) 87 - #define WSYN_DLY (LCD_CONTROL_BLOCK_BASE|0x58) 88 - #define REGENB (LCD_CONTROL_BLOCK_BASE|0x5C) 89 - #define VSYNIF (LCD_CONTROL_BLOCK_BASE|0x60) 90 - #define WRSTB (LCD_CONTROL_BLOCK_BASE|0x64) 91 - #define RDSTB (LCD_CONTROL_BLOCK_BASE|0x68) 92 - #define ASY_DATA (LCD_CONTROL_BLOCK_BASE|0x6C) 93 - #define ASY_DATB (LCD_CONTROL_BLOCK_BASE|0x70) 94 - #define ASY_DATC (LCD_CONTROL_BLOCK_BASE|0x74) 95 - #define ASY_DATD (LCD_CONTROL_BLOCK_BASE|0x78) 96 - #define ASY_DATE (LCD_CONTROL_BLOCK_BASE|0x7C) 97 - #define ASY_DATF (LCD_CONTROL_BLOCK_BASE|0x80) 98 - #define ASY_DATG (LCD_CONTROL_BLOCK_BASE|0x84) 99 - #define ASY_DATH (LCD_CONTROL_BLOCK_BASE|0x88) 100 - #define ASY_CMDSET (LCD_CONTROL_BLOCK_BASE|0x8C) 101 - 102 - #define SSICTL (SPI_BLOCK_BASE|0x00) 103 - #define SSITIME (SPI_BLOCK_BASE|0x04) 104 - #define SSITX (SPI_BLOCK_BASE|0x08) 105 - #define SSIRX (SPI_BLOCK_BASE|0x0C) 106 - #define SSIINTC (SPI_BLOCK_BASE|0x10) 107 - #define SSIINTS (SPI_BLOCK_BASE|0x14) 108 - #define SSIDBG1 (SPI_BLOCK_BASE|0x18) 109 - #define SSIDBG2 (SPI_BLOCK_BASE|0x1C) 110 - #define SSIID (SPI_BLOCK_BASE|0x20) 111 - 112 - #define WKREQ (SYSTEM_BLOCK1_BASE|0x00) 113 - #define CLKENB (SYSTEM_BLOCK1_BASE|0x04) 114 - #define DRAMPWR (SYSTEM_BLOCK1_BASE|0x08) 115 - #define INTMASK (SYSTEM_BLOCK1_BASE|0x0C) 116 - #define GPIOSEL (SYSTEM_BLOCK2_BASE|0x00) 117 - 118 - #define GPIODATA (GPIO_BLOCK_BASE|0x00) 119 - #define GPIODIR (GPIO_BLOCK_BASE|0x04) 120 - #define GPIOIS (GPIO_BLOCK_BASE|0x08) 121 - #define GPIOIBE (GPIO_BLOCK_BASE|0x0C) 122 - #define GPIOIEV (GPIO_BLOCK_BASE|0x10) 123 - #define GPIOIE (GPIO_BLOCK_BASE|0x14) 124 - #define GPIORIS (GPIO_BLOCK_BASE|0x18) 125 - #define GPIOMIS (GPIO_BLOCK_BASE|0x1C) 126 - #define GPIOIC (GPIO_BLOCK_BASE|0x20) 127 - #define GPIOOMS (GPIO_BLOCK_BASE|0x24) 128 - #define GPIOPC (GPIO_BLOCK_BASE|0x28) 129 - #define GPIOID (GPIO_BLOCK_BASE|0x30) 130 - 131 - #define SPI_WRITE(reg, val) \ 132 - { SSITX, 0x00010000 | (((reg) & 0xff) << 8) | ((val) & 0xff) }, \ 133 - { 0, 5 }, 134 - 135 - #define SPI_WRITE1(reg) \ 136 - { SSITX, (reg) & 0xff }, \ 137 - { 0, 5 }, 138 - 139 - struct mddi_table { 140 - uint32_t reg; 141 - uint32_t value; 142 - }; 143 - static struct mddi_table mddi_toshiba_init_table[] = { 144 - { DPSET0, 0x09e90046 }, 145 - { DPSET1, 0x00000118 }, 146 - { DPSUS, 0x00000000 }, 147 - { DPRUN, 0x00000001 }, 148 - { 1, 14 }, /* msleep 14 */ 149 - { SYSCKENA, 0x00000001 }, 150 - { CLKENB, 0x0000A1EF }, /* # SYS.CLKENB # Enable clocks for each module (without DCLK , i2cCLK) */ 151 - 152 - { GPIODATA, 0x02000200 }, /* # GPI .GPIODATA # GPIO2(RESET_LCD_N) set to 0 , GPIO3(eDRAM_Power) set to 0 */ 153 - { GPIODIR, 0x000030D }, /* 24D # GPI .GPIODIR # Select direction of GPIO port (0,2,3,6,9 output) */ 154 - { GPIOSEL, 0/*0x00000173*/}, /* # SYS.GPIOSEL # GPIO port multiplexing control */ 155 - { GPIOPC, 0x03C300C0 }, /* # GPI .GPIOPC # GPIO2,3 PD cut */ 156 - { WKREQ, 0x00000000 }, /* # SYS.WKREQ # Wake-up request event is VSYNC alignment */ 157 - 158 - { GPIOIBE, 0x000003FF }, 159 - { GPIOIS, 0x00000000 }, 160 - { GPIOIC, 0x000003FF }, 161 - { GPIOIE, 0x00000000 }, 162 - 163 - { GPIODATA, 0x00040004 }, /* # GPI .GPIODATA # eDRAM VD supply */ 164 - { 1, 1 }, /* msleep 1 */ 165 - { GPIODATA, 0x02040004 }, /* # GPI .GPIODATA # eDRAM VD supply */ 166 - { DRAMPWR, 0x00000001 }, /* eDRAM power */ 167 - }; 168 - 169 - #define GPIOSEL_VWAKEINT (1U << 0) 170 - #define INTMASK_VWAKEOUT (1U << 0) 171 - 172 - 173 - static int trout_new_backlight = 1; 174 - static struct vreg *vreg_mddi_1v5; 175 - static struct vreg *vreg_lcm_2v85; 176 - 177 - static void trout_process_mddi_table(struct msm_mddi_client_data *client_data, 178 - struct mddi_table *table, size_t count) 179 - { 180 - int i; 181 - for (i = 0; i < count; i++) { 182 - uint32_t reg = table[i].reg; 183 - uint32_t value = table[i].value; 184 - 185 - if (reg == 0) 186 - udelay(value); 187 - else if (reg == 1) 188 - msleep(value); 189 - else 190 - client_data->remote_write(client_data, value, reg); 191 - } 192 - } 193 - 194 - static int trout_mddi_toshiba_client_init( 195 - struct msm_mddi_bridge_platform_data *bridge_data, 196 - struct msm_mddi_client_data *client_data) 197 - { 198 - int panel_id; 199 - 200 - client_data->auto_hibernate(client_data, 0); 201 - trout_process_mddi_table(client_data, mddi_toshiba_init_table, 202 - ARRAY_SIZE(mddi_toshiba_init_table)); 203 - client_data->auto_hibernate(client_data, 1); 204 - panel_id = (client_data->remote_read(client_data, GPIODATA) >> 4) & 3; 205 - if (panel_id > 1) { 206 - printk(KERN_WARNING "unknown panel id at mddi_enable\n"); 207 - return -1; 208 - } 209 - return 0; 210 - } 211 - 212 - static int trout_mddi_toshiba_client_uninit( 213 - struct msm_mddi_bridge_platform_data *bridge_data, 214 - struct msm_mddi_client_data *client_data) 215 - { 216 - return 0; 217 - } 218 - 219 - static struct resource resources_msm_fb[] = { 220 - { 221 - .start = MSM_FB_BASE, 222 - .end = MSM_FB_BASE + MSM_FB_SIZE, 223 - .flags = IORESOURCE_MEM, 224 - }, 225 - }; 226 - 227 - struct msm_mddi_bridge_platform_data toshiba_client_data = { 228 - .init = trout_mddi_toshiba_client_init, 229 - .uninit = trout_mddi_toshiba_client_uninit, 230 - .fb_data = { 231 - .xres = 320, 232 - .yres = 480, 233 - .width = 45, 234 - .height = 67, 235 - .output_format = 0, 236 - }, 237 - }; 238 - 239 - static struct msm_mddi_platform_data mddi_pdata = { 240 - .clk_rate = 122880000, 241 - .fb_resource = resources_msm_fb, 242 - .num_clients = 1, 243 - .client_platform_data = { 244 - { 245 - .product_id = (0xd263 << 16 | 0), 246 - .name = "mddi_c_d263_0000", 247 - .id = 0, 248 - .client_data = &toshiba_client_data, 249 - .clk_rate = 0, 250 - }, 251 - }, 252 - }; 253 - 254 - int __init trout_init_panel(void) 255 - { 256 - int rc; 257 - 258 - if (!machine_is_trout()) 259 - return 0; 260 - vreg_mddi_1v5 = vreg_get(0, "gp2"); 261 - if (IS_ERR(vreg_mddi_1v5)) 262 - return PTR_ERR(vreg_mddi_1v5); 263 - vreg_lcm_2v85 = vreg_get(0, "gp4"); 264 - if (IS_ERR(vreg_lcm_2v85)) 265 - return PTR_ERR(vreg_lcm_2v85); 266 - 267 - trout_new_backlight = system_rev >= 5; 268 - if (trout_new_backlight) { 269 - uint32_t config = PCOM_GPIO_CFG(27, 0, GPIO_OUTPUT, 270 - GPIO_NO_PULL, GPIO_8MA); 271 - msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, 0); 272 - } else { 273 - uint32_t config = PCOM_GPIO_CFG(27, 1, GPIO_OUTPUT, 274 - GPIO_NO_PULL, GPIO_8MA); 275 - uint32_t id = P_GP_CLK; 276 - uint32_t rate = 19200000; 277 - 278 - msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, 0); 279 - 280 - msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate); 281 - if (id < 0) 282 - pr_err("trout_init_panel: set clock rate failed\n"); 283 - } 284 - 285 - rc = platform_device_register(&msm_device_mdp); 286 - if (rc) 287 - return rc; 288 - msm_device_mddi0.dev.platform_data = &mddi_pdata; 289 - return platform_device_register(&msm_device_mddi0); 290 - } 291 - 292 - device_initcall(trout_init_panel);
-111
arch/arm/mach-msm/board-trout.c
··· 1 - /* linux/arch/arm/mach-msm/board-trout.c 2 - * 3 - * Copyright (C) 2009 Google, Inc. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - #define pr_fmt(fmt) "%s: " fmt, __func__ 17 - 18 - #include <linux/kernel.h> 19 - #include <linux/init.h> 20 - #include <linux/platform_device.h> 21 - #include <linux/clkdev.h> 22 - #include <linux/memblock.h> 23 - 24 - #include <asm/system_info.h> 25 - #include <asm/mach-types.h> 26 - #include <asm/mach/arch.h> 27 - #include <asm/mach/map.h> 28 - #include <asm/setup.h> 29 - 30 - #include <mach/hardware.h> 31 - #include <mach/msm_iomap.h> 32 - 33 - #include "devices.h" 34 - #include "board-trout.h" 35 - #include "common.h" 36 - 37 - extern int trout_init_mmc(unsigned int); 38 - 39 - static struct platform_device *devices[] __initdata = { 40 - &msm_clock_7x01a, 41 - &msm_device_gpio_7201, 42 - &msm_device_uart3, 43 - &msm_device_smd, 44 - &msm_device_nand, 45 - &msm_device_hsusb, 46 - &msm_device_i2c, 47 - }; 48 - 49 - static void __init trout_init_early(void) 50 - { 51 - arch_ioremap_caller = __msm_ioremap_caller; 52 - } 53 - 54 - static void __init trout_init_irq(void) 55 - { 56 - msm_init_irq(); 57 - } 58 - 59 - static void __init trout_fixup(struct tag *tags, char **cmdline) 60 - { 61 - memblock_add(PHYS_OFFSET, 101*SZ_1M); 62 - } 63 - 64 - static void __init trout_init(void) 65 - { 66 - int rc; 67 - 68 - platform_add_devices(devices, ARRAY_SIZE(devices)); 69 - 70 - if (IS_ENABLED(CONFIG_MMC)) { 71 - rc = trout_init_mmc(system_rev); 72 - if (rc) 73 - pr_crit("MMC init failure (%d)\n", rc); 74 - } 75 - } 76 - 77 - static struct map_desc trout_io_desc[] __initdata = { 78 - { 79 - .virtual = (unsigned long)TROUT_CPLD_BASE, 80 - .pfn = __phys_to_pfn(TROUT_CPLD_START), 81 - .length = TROUT_CPLD_SIZE, 82 - .type = MT_DEVICE_NONSHARED 83 - } 84 - }; 85 - 86 - static void __init trout_map_io(void) 87 - { 88 - msm_map_common_io(); 89 - iotable_init(trout_io_desc, ARRAY_SIZE(trout_io_desc)); 90 - 91 - #if defined(CONFIG_DEBUG_MSM_UART) && (CONFIG_DEBUG_UART_PHYS == 0xa9c00000) 92 - /* route UART3 to the "H2W" extended usb connector */ 93 - writeb(0x80, TROUT_CPLD_BASE + 0x00); 94 - #endif 95 - } 96 - 97 - static void __init trout_init_late(void) 98 - { 99 - smd_debugfs_init(); 100 - } 101 - 102 - MACHINE_START(TROUT, "HTC Dream") 103 - .atag_offset = 0x100, 104 - .fixup = trout_fixup, 105 - .map_io = trout_map_io, 106 - .init_early = trout_init_early, 107 - .init_irq = trout_init_irq, 108 - .init_machine = trout_init, 109 - .init_late = trout_init_late, 110 - .init_time = msm7x01_timer_init, 111 - MACHINE_END
-162
arch/arm/mach-msm/board-trout.h
··· 1 - /* linux/arch/arm/mach-msm/board-trout.h 2 - ** Author: Brian Swetland <swetland@google.com> 3 - */ 4 - #ifndef __ARCH_ARM_MACH_MSM_BOARD_TROUT_H 5 - #define __ARCH_ARM_MACH_MSM_BOARD_TROUT_H 6 - 7 - #include "common.h" 8 - 9 - #define MSM_SMI_BASE 0x00000000 10 - #define MSM_SMI_SIZE 0x00800000 11 - 12 - #define MSM_EBI_BASE 0x10000000 13 - #define MSM_EBI_SIZE 0x06e00000 14 - 15 - #define MSM_PMEM_GPU0_BASE 0x00000000 16 - #define MSM_PMEM_GPU0_SIZE 0x00700000 17 - 18 - #define MSM_PMEM_MDP_BASE 0x02000000 19 - #define MSM_PMEM_MDP_SIZE 0x00800000 20 - 21 - #define MSM_PMEM_ADSP_BASE 0x02800000 22 - #define MSM_PMEM_ADSP_SIZE 0x00800000 23 - 24 - #define MSM_PMEM_CAMERA_BASE 0x03000000 25 - #define MSM_PMEM_CAMERA_SIZE 0x00800000 26 - 27 - #define MSM_FB_BASE 0x03800000 28 - #define MSM_FB_SIZE 0x00100000 29 - 30 - #define MSM_LINUX_BASE MSM_EBI_BASE 31 - #define MSM_LINUX_SIZE 0x06500000 32 - 33 - #define MSM_PMEM_GPU1_SIZE 0x800000 34 - #define MSM_PMEM_GPU1_BASE (MSM_RAM_CONSOLE_BASE - MSM_PMEM_GPU1_SIZE) 35 - 36 - #define MSM_RAM_CONSOLE_BASE (MSM_EBI_BASE + 0x6d00000) 37 - #define MSM_RAM_CONSOLE_SIZE (128 * SZ_1K) 38 - 39 - #if (MSM_FB_BASE + MSM_FB_SIZE) >= (MSM_PMEM_GPU1_BASE) 40 - #error invalid memory map 41 - #endif 42 - 43 - #define DECLARE_MSM_IOMAP 44 - #include <mach/msm_iomap.h> 45 - 46 - #define TROUT_4_BALL_UP_0 1 47 - #define TROUT_4_BALL_LEFT_0 18 48 - #define TROUT_4_BALL_DOWN_0 57 49 - #define TROUT_4_BALL_RIGHT_0 91 50 - 51 - #define TROUT_5_BALL_UP_0 94 52 - #define TROUT_5_BALL_LEFT_0 18 53 - #define TROUT_5_BALL_DOWN_0 90 54 - #define TROUT_5_BALL_RIGHT_0 19 55 - 56 - #define TROUT_POWER_KEY 20 57 - 58 - #define TROUT_4_TP_LS_EN 19 59 - #define TROUT_5_TP_LS_EN 1 60 - 61 - #define TROUT_CPLD_BASE IOMEM(0xE8100000) 62 - #define TROUT_CPLD_START 0x98000000 63 - #define TROUT_CPLD_SIZE SZ_4K 64 - 65 - #define TROUT_GPIO_CABLE_IN1 (83) 66 - #define TROUT_GPIO_CABLE_IN2 (49) 67 - 68 - #define TROUT_GPIO_START (128) 69 - 70 - #define TROUT_GPIO_INT_MASK0_REG (0x0c) 71 - #define TROUT_GPIO_INT_STAT0_REG (0x0e) 72 - #define TROUT_GPIO_INT_MASK1_REG (0x14) 73 - #define TROUT_GPIO_INT_STAT1_REG (0x10) 74 - 75 - #define TROUT_GPIO_HAPTIC_PWM (28) 76 - #define TROUT_GPIO_PS_HOLD (25) 77 - 78 - #define TROUT_GPIO_MISC2_BASE (TROUT_GPIO_START + 0x00) 79 - #define TROUT_GPIO_MISC3_BASE (TROUT_GPIO_START + 0x08) 80 - #define TROUT_GPIO_MISC4_BASE (TROUT_GPIO_START + 0x10) 81 - #define TROUT_GPIO_MISC5_BASE (TROUT_GPIO_START + 0x18) 82 - #define TROUT_GPIO_INT2_BASE (TROUT_GPIO_START + 0x20) 83 - #define TROUT_GPIO_MISC1_BASE (TROUT_GPIO_START + 0x28) 84 - #define TROUT_GPIO_VIRTUAL_BASE (TROUT_GPIO_START + 0x30) 85 - #define TROUT_GPIO_INT5_BASE (TROUT_GPIO_START + 0x48) 86 - 87 - #define TROUT_GPIO_CHARGER_EN (TROUT_GPIO_MISC2_BASE + 0) 88 - #define TROUT_GPIO_ISET (TROUT_GPIO_MISC2_BASE + 1) 89 - #define TROUT_GPIO_H2W_DAT_DIR (TROUT_GPIO_MISC2_BASE + 2) 90 - #define TROUT_GPIO_H2W_CLK_DIR (TROUT_GPIO_MISC2_BASE + 3) 91 - #define TROUT_GPIO_H2W_DAT_GPO (TROUT_GPIO_MISC2_BASE + 4) 92 - #define TROUT_GPIO_H2W_CLK_GPO (TROUT_GPIO_MISC2_BASE + 5) 93 - #define TROUT_GPIO_H2W_SEL0 (TROUT_GPIO_MISC2_BASE + 6) 94 - #define TROUT_GPIO_H2W_SEL1 (TROUT_GPIO_MISC2_BASE + 7) 95 - 96 - #define TROUT_GPIO_SPOTLIGHT_EN (TROUT_GPIO_MISC3_BASE + 0) 97 - #define TROUT_GPIO_FLASH_EN (TROUT_GPIO_MISC3_BASE + 1) 98 - #define TROUT_GPIO_I2C_PULL (TROUT_GPIO_MISC3_BASE + 2) 99 - #define TROUT_GPIO_TP_I2C_PULL (TROUT_GPIO_MISC3_BASE + 3) 100 - #define TROUT_GPIO_TP_EN (TROUT_GPIO_MISC3_BASE + 4) 101 - #define TROUT_GPIO_JOG_EN (TROUT_GPIO_MISC3_BASE + 5) 102 - #define TROUT_GPIO_UI_LED_EN (TROUT_GPIO_MISC3_BASE + 6) 103 - #define TROUT_GPIO_QTKEY_LED_EN (TROUT_GPIO_MISC3_BASE + 7) 104 - 105 - #define TROUT_GPIO_VCM_PWDN (TROUT_GPIO_MISC4_BASE + 0) 106 - #define TROUT_GPIO_USB_H2W_SW (TROUT_GPIO_MISC4_BASE + 1) 107 - #define TROUT_GPIO_COMPASS_RST_N (TROUT_GPIO_MISC4_BASE + 2) 108 - #define TROUT_GPIO_HAPTIC_EN_UP (TROUT_GPIO_MISC4_BASE + 3) 109 - #define TROUT_GPIO_HAPTIC_EN_MAIN (TROUT_GPIO_MISC4_BASE + 4) 110 - #define TROUT_GPIO_USB_PHY_RST_N (TROUT_GPIO_MISC4_BASE + 5) 111 - #define TROUT_GPIO_WIFI_PA_RESETX (TROUT_GPIO_MISC4_BASE + 6) 112 - #define TROUT_GPIO_WIFI_EN (TROUT_GPIO_MISC4_BASE + 7) 113 - 114 - #define TROUT_GPIO_BT_32K_EN (TROUT_GPIO_MISC5_BASE + 0) 115 - #define TROUT_GPIO_MAC_32K_EN (TROUT_GPIO_MISC5_BASE + 1) 116 - #define TROUT_GPIO_MDDI_32K_EN (TROUT_GPIO_MISC5_BASE + 2) 117 - #define TROUT_GPIO_COMPASS_32K_EN (TROUT_GPIO_MISC5_BASE + 3) 118 - 119 - #define TROUT_GPIO_NAVI_ACT_N (TROUT_GPIO_INT2_BASE + 0) 120 - #define TROUT_GPIO_COMPASS_IRQ (TROUT_GPIO_INT2_BASE + 1) 121 - #define TROUT_GPIO_SLIDING_DET (TROUT_GPIO_INT2_BASE + 2) 122 - #define TROUT_GPIO_AUD_HSMIC_DET_N (TROUT_GPIO_INT2_BASE + 3) 123 - #define TROUT_GPIO_SD_DOOR_N (TROUT_GPIO_INT2_BASE + 4) 124 - #define TROUT_GPIO_CAM_BTN_STEP1_N (TROUT_GPIO_INT2_BASE + 5) 125 - #define TROUT_GPIO_CAM_BTN_STEP2_N (TROUT_GPIO_INT2_BASE + 6) 126 - #define TROUT_GPIO_TP_ATT_N (TROUT_GPIO_INT2_BASE + 7) 127 - #define TROUT_GPIO_BANK0_FIRST_INT_SOURCE (TROUT_GPIO_NAVI_ACT_N) 128 - #define TROUT_GPIO_BANK0_LAST_INT_SOURCE (TROUT_GPIO_TP_ATT_N) 129 - 130 - #define TROUT_GPIO_H2W_DAT_GPI (TROUT_GPIO_MISC1_BASE + 0) 131 - #define TROUT_GPIO_H2W_CLK_GPI (TROUT_GPIO_MISC1_BASE + 1) 132 - #define TROUT_GPIO_CPLD128_VER_0 (TROUT_GPIO_MISC1_BASE + 4) 133 - #define TROUT_GPIO_CPLD128_VER_1 (TROUT_GPIO_MISC1_BASE + 5) 134 - #define TROUT_GPIO_CPLD128_VER_2 (TROUT_GPIO_MISC1_BASE + 6) 135 - #define TROUT_GPIO_CPLD128_VER_3 (TROUT_GPIO_MISC1_BASE + 7) 136 - 137 - #define TROUT_GPIO_SDMC_CD_N (TROUT_GPIO_VIRTUAL_BASE + 0) 138 - #define TROUT_GPIO_END (TROUT_GPIO_SDMC_CD_N) 139 - #define TROUT_GPIO_BANK1_FIRST_INT_SOURCE (TROUT_GPIO_SDMC_CD_N) 140 - #define TROUT_GPIO_BANK1_LAST_INT_SOURCE (TROUT_GPIO_SDMC_CD_N) 141 - 142 - #define TROUT_GPIO_VIRTUAL_TO_REAL_OFFSET \ 143 - (TROUT_GPIO_INT5_BASE - TROUT_GPIO_VIRTUAL_BASE) 144 - 145 - #define TROUT_INT_START (NR_MSM_IRQS + NR_GPIO_IRQS) 146 - #define TROUT_INT_BANK0_COUNT (8) 147 - #define TROUT_INT_BANK1_START (TROUT_INT_START + TROUT_INT_BANK0_COUNT) 148 - #define TROUT_INT_BANK1_COUNT (1) 149 - #define TROUT_INT_END (TROUT_INT_START + TROUT_INT_BANK0_COUNT + \ 150 - TROUT_INT_BANK1_COUNT - 1) 151 - #define TROUT_GPIO_TO_INT(n) (((n) <= TROUT_GPIO_BANK0_LAST_INT_SOURCE) ? \ 152 - (TROUT_INT_START - TROUT_GPIO_BANK0_FIRST_INT_SOURCE + (n)) : \ 153 - (TROUT_INT_BANK1_START - TROUT_GPIO_BANK1_FIRST_INT_SOURCE + (n))) 154 - 155 - #define TROUT_INT_TO_BANK(n) ((n - TROUT_INT_START) / TROUT_INT_BANK0_COUNT) 156 - #define TROUT_INT_TO_MASK(n) (1U << ((n - TROUT_INT_START) & 7)) 157 - #define TROUT_BANK_TO_MASK_REG(bank) \ 158 - (bank ? TROUT_GPIO_INT_MASK1_REG : TROUT_GPIO_INT_MASK0_REG) 159 - #define TROUT_BANK_TO_STAT_REG(bank) \ 160 - (bank ? TROUT_GPIO_INT_STAT1_REG : TROUT_GPIO_INT_STAT0_REG) 161 - 162 - #endif /* GUARD */
-176
arch/arm/mach-msm/clock-pcom.c
··· 1 - /* 2 - * Copyright (C) 2007 Google, Inc. 3 - * Copyright (c) 2007-2012, The Linux Foundation. All rights reserved. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #include <linux/kernel.h> 17 - #include <linux/err.h> 18 - #include <linux/platform_device.h> 19 - #include <linux/module.h> 20 - #include <linux/clk-provider.h> 21 - #include <linux/clkdev.h> 22 - 23 - #include <mach/clk.h> 24 - 25 - #include "proc_comm.h" 26 - #include "clock.h" 27 - #include "clock-pcom.h" 28 - 29 - struct clk_pcom { 30 - unsigned id; 31 - unsigned long flags; 32 - struct msm_clk msm_clk; 33 - }; 34 - 35 - static inline struct clk_pcom *to_clk_pcom(struct clk_hw *hw) 36 - { 37 - return container_of(to_msm_clk(hw), struct clk_pcom, msm_clk); 38 - } 39 - 40 - static int pc_clk_enable(struct clk_hw *hw) 41 - { 42 - unsigned id = to_clk_pcom(hw)->id; 43 - int rc = msm_proc_comm(PCOM_CLKCTL_RPC_ENABLE, &id, NULL); 44 - if (rc < 0) 45 - return rc; 46 - else 47 - return (int)id < 0 ? -EINVAL : 0; 48 - } 49 - 50 - static void pc_clk_disable(struct clk_hw *hw) 51 - { 52 - unsigned id = to_clk_pcom(hw)->id; 53 - msm_proc_comm(PCOM_CLKCTL_RPC_DISABLE, &id, NULL); 54 - } 55 - 56 - static int pc_clk_reset(struct clk_hw *hw, enum clk_reset_action action) 57 - { 58 - int rc; 59 - unsigned id = to_clk_pcom(hw)->id; 60 - 61 - if (action == CLK_RESET_ASSERT) 62 - rc = msm_proc_comm(PCOM_CLKCTL_RPC_RESET_ASSERT, &id, NULL); 63 - else 64 - rc = msm_proc_comm(PCOM_CLKCTL_RPC_RESET_DEASSERT, &id, NULL); 65 - 66 - if (rc < 0) 67 - return rc; 68 - else 69 - return (int)id < 0 ? -EINVAL : 0; 70 - } 71 - 72 - static int pc_clk_set_rate(struct clk_hw *hw, unsigned long new_rate, 73 - unsigned long p_rate) 74 - { 75 - struct clk_pcom *p = to_clk_pcom(hw); 76 - unsigned id = p->id, rate = new_rate; 77 - int rc; 78 - 79 - /* 80 - * The rate _might_ be rounded off to the nearest KHz value by the 81 - * remote function. So a return value of 0 doesn't necessarily mean 82 - * that the exact rate was set successfully. 83 - */ 84 - if (p->flags & CLKFLAG_MIN) 85 - rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate); 86 - else 87 - rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate); 88 - if (rc < 0) 89 - return rc; 90 - else 91 - return (int)id < 0 ? -EINVAL : 0; 92 - } 93 - 94 - static unsigned long pc_clk_recalc_rate(struct clk_hw *hw, unsigned long p_rate) 95 - { 96 - unsigned id = to_clk_pcom(hw)->id; 97 - if (msm_proc_comm(PCOM_CLKCTL_RPC_RATE, &id, NULL)) 98 - return 0; 99 - else 100 - return id; 101 - } 102 - 103 - static int pc_clk_is_enabled(struct clk_hw *hw) 104 - { 105 - unsigned id = to_clk_pcom(hw)->id; 106 - if (msm_proc_comm(PCOM_CLKCTL_RPC_ENABLED, &id, NULL)) 107 - return 0; 108 - else 109 - return id; 110 - } 111 - 112 - static long pc_clk_round_rate(struct clk_hw *hw, unsigned long rate, 113 - unsigned long *p_rate) 114 - { 115 - /* Not really supported; pc_clk_set_rate() does rounding on it's own. */ 116 - return rate; 117 - } 118 - 119 - static struct clk_ops clk_ops_pcom = { 120 - .enable = pc_clk_enable, 121 - .disable = pc_clk_disable, 122 - .set_rate = pc_clk_set_rate, 123 - .recalc_rate = pc_clk_recalc_rate, 124 - .is_enabled = pc_clk_is_enabled, 125 - .round_rate = pc_clk_round_rate, 126 - }; 127 - 128 - static int msm_clock_pcom_probe(struct platform_device *pdev) 129 - { 130 - const struct pcom_clk_pdata *pdata = pdev->dev.platform_data; 131 - int i, ret; 132 - 133 - for (i = 0; i < pdata->num_lookups; i++) { 134 - const struct clk_pcom_desc *desc = &pdata->lookup[i]; 135 - struct clk *c; 136 - struct clk_pcom *p; 137 - struct clk_hw *hw; 138 - struct clk_init_data init; 139 - 140 - p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); 141 - if (!p) 142 - return -ENOMEM; 143 - 144 - p->id = desc->id; 145 - p->flags = desc->flags; 146 - p->msm_clk.reset = pc_clk_reset; 147 - 148 - hw = &p->msm_clk.hw; 149 - hw->init = &init; 150 - 151 - init.name = desc->name; 152 - init.ops = &clk_ops_pcom; 153 - init.num_parents = 0; 154 - init.flags = CLK_IS_ROOT; 155 - 156 - if (!(p->flags & CLKFLAG_AUTO_OFF)) 157 - init.flags |= CLK_IGNORE_UNUSED; 158 - 159 - c = devm_clk_register(&pdev->dev, hw); 160 - ret = clk_register_clkdev(c, desc->con, desc->dev); 161 - if (ret) 162 - return ret; 163 - } 164 - 165 - return 0; 166 - } 167 - 168 - static struct platform_driver msm_clock_pcom_driver = { 169 - .probe = msm_clock_pcom_probe, 170 - .driver = { 171 - .name = "msm-clock-pcom", 172 - }, 173 - }; 174 - module_platform_driver(msm_clock_pcom_driver); 175 - 176 - MODULE_LICENSE("GPL v2");
-145
arch/arm/mach-msm/clock-pcom.h
··· 1 - /* 2 - * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License version 2 and 6 - * only version 2 as published by the Free Software Foundation. 7 - * 8 - * This program is distributed in the hope that it will be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 - */ 13 - 14 - #ifndef __ARCH_ARM_MACH_MSM_CLOCK_PCOM_H 15 - #define __ARCH_ARM_MACH_MSM_CLOCK_PCOM_H 16 - 17 - /* clock IDs used by the modem processor */ 18 - 19 - #define P_ACPU_CLK 0 /* Applications processor clock */ 20 - #define P_ADM_CLK 1 /* Applications data mover clock */ 21 - #define P_ADSP_CLK 2 /* ADSP clock */ 22 - #define P_EBI1_CLK 3 /* External bus interface 1 clock */ 23 - #define P_EBI2_CLK 4 /* External bus interface 2 clock */ 24 - #define P_ECODEC_CLK 5 /* External CODEC clock */ 25 - #define P_EMDH_CLK 6 /* External MDDI host clock */ 26 - #define P_GP_CLK 7 /* General purpose clock */ 27 - #define P_GRP_3D_CLK 8 /* Graphics clock */ 28 - #define P_I2C_CLK 9 /* I2C clock */ 29 - #define P_ICODEC_RX_CLK 10 /* Internal CODEX RX clock */ 30 - #define P_ICODEC_TX_CLK 11 /* Internal CODEX TX clock */ 31 - #define P_IMEM_CLK 12 /* Internal graphics memory clock */ 32 - #define P_MDC_CLK 13 /* MDDI client clock */ 33 - #define P_MDP_CLK 14 /* Mobile display processor clock */ 34 - #define P_PBUS_CLK 15 /* Peripheral bus clock */ 35 - #define P_PCM_CLK 16 /* PCM clock */ 36 - #define P_PMDH_CLK 17 /* Primary MDDI host clock */ 37 - #define P_SDAC_CLK 18 /* Stereo DAC clock */ 38 - #define P_SDC1_CLK 19 /* Secure Digital Card clocks */ 39 - #define P_SDC1_P_CLK 20 40 - #define P_SDC2_CLK 21 41 - #define P_SDC2_P_CLK 22 42 - #define P_SDC3_CLK 23 43 - #define P_SDC3_P_CLK 24 44 - #define P_SDC4_CLK 25 45 - #define P_SDC4_P_CLK 26 46 - #define P_TSIF_CLK 27 /* Transport Stream Interface clocks */ 47 - #define P_TSIF_REF_CLK 28 48 - #define P_TV_DAC_CLK 29 /* TV clocks */ 49 - #define P_TV_ENC_CLK 30 50 - #define P_UART1_CLK 31 /* UART clocks */ 51 - #define P_UART2_CLK 32 52 - #define P_UART3_CLK 33 53 - #define P_UART1DM_CLK 34 54 - #define P_UART2DM_CLK 35 55 - #define P_USB_HS_CLK 36 /* High speed USB core clock */ 56 - #define P_USB_HS_P_CLK 37 /* High speed USB pbus clock */ 57 - #define P_USB_OTG_CLK 38 /* Full speed USB clock */ 58 - #define P_VDC_CLK 39 /* Video controller clock */ 59 - #define P_VFE_MDC_CLK 40 /* Camera / Video Front End clock */ 60 - #define P_VFE_CLK 41 /* VFE MDDI client clock */ 61 - #define P_MDP_LCDC_PCLK_CLK 42 62 - #define P_MDP_LCDC_PAD_PCLK_CLK 43 63 - #define P_MDP_VSYNC_CLK 44 64 - #define P_SPI_CLK 45 65 - #define P_VFE_AXI_CLK 46 66 - #define P_USB_HS2_CLK 47 /* High speed USB 2 core clock */ 67 - #define P_USB_HS2_P_CLK 48 /* High speed USB 2 pbus clock */ 68 - #define P_USB_HS3_CLK 49 /* High speed USB 3 core clock */ 69 - #define P_USB_HS3_P_CLK 50 /* High speed USB 3 pbus clock */ 70 - #define P_GRP_3D_P_CLK 51 /* Graphics pbus clock */ 71 - #define P_USB_PHY_CLK 52 /* USB PHY clock */ 72 - #define P_USB_HS_CORE_CLK 53 /* High speed USB 1 core clock */ 73 - #define P_USB_HS2_CORE_CLK 54 /* High speed USB 2 core clock */ 74 - #define P_USB_HS3_CORE_CLK 55 /* High speed USB 3 core clock */ 75 - #define P_CAM_M_CLK 56 76 - #define P_CAMIF_PAD_P_CLK 57 77 - #define P_GRP_2D_CLK 58 78 - #define P_GRP_2D_P_CLK 59 79 - #define P_I2S_CLK 60 80 - #define P_JPEG_CLK 61 81 - #define P_JPEG_P_CLK 62 82 - #define P_LPA_CODEC_CLK 63 83 - #define P_LPA_CORE_CLK 64 84 - #define P_LPA_P_CLK 65 85 - #define P_MDC_IO_CLK 66 86 - #define P_MDC_P_CLK 67 87 - #define P_MFC_CLK 68 88 - #define P_MFC_DIV2_CLK 69 89 - #define P_MFC_P_CLK 70 90 - #define P_QUP_I2C_CLK 71 91 - #define P_ROTATOR_IMEM_CLK 72 92 - #define P_ROTATOR_P_CLK 73 93 - #define P_VFE_CAMIF_CLK 74 94 - #define P_VFE_P_CLK 75 95 - #define P_VPE_CLK 76 96 - #define P_I2C_2_CLK 77 97 - #define P_MI2S_CODEC_RX_S_CLK 78 98 - #define P_MI2S_CODEC_RX_M_CLK 79 99 - #define P_MI2S_CODEC_TX_S_CLK 80 100 - #define P_MI2S_CODEC_TX_M_CLK 81 101 - #define P_PMDH_P_CLK 82 102 - #define P_EMDH_P_CLK 83 103 - #define P_SPI_P_CLK 84 104 - #define P_TSIF_P_CLK 85 105 - #define P_MDP_P_CLK 86 106 - #define P_SDAC_M_CLK 87 107 - #define P_MI2S_S_CLK 88 108 - #define P_MI2S_M_CLK 89 109 - #define P_AXI_ROTATOR_CLK 90 110 - #define P_HDMI_CLK 91 111 - #define P_CSI0_CLK 92 112 - #define P_CSI0_VFE_CLK 93 113 - #define P_CSI0_P_CLK 94 114 - #define P_CSI1_CLK 95 115 - #define P_CSI1_VFE_CLK 96 116 - #define P_CSI1_P_CLK 97 117 - #define P_GSBI_CLK 98 118 - #define P_GSBI_P_CLK 99 119 - #define P_CE_CLK 100 /* Crypto engine */ 120 - #define P_CODEC_SSBI_CLK 101 121 - 122 - #define P_NR_CLKS 102 123 - 124 - struct clk_pcom_desc { 125 - unsigned id; 126 - const char *name; 127 - const char *con; 128 - const char *dev; 129 - unsigned long flags; 130 - }; 131 - 132 - struct pcom_clk_pdata { 133 - struct clk_pcom_desc *lookup; 134 - u32 num_lookups; 135 - }; 136 - 137 - #define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \ 138 - .id = P_##clk_id, \ 139 - .name = #clk_id, \ 140 - .con = clk_name, \ 141 - .dev = clk_dev, \ 142 - .flags = clk_flags, \ 143 - } 144 - 145 - #endif
-28
arch/arm/mach-msm/clock.c
··· 1 - /* arch/arm/mach-msm/clock.c 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * Copyright (c) 2007-2012, The Linux Foundation. All rights reserved. 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - 17 - #include <linux/clk-provider.h> 18 - #include <linux/module.h> 19 - 20 - #include "clock.h" 21 - 22 - int clk_reset(struct clk *clk, enum clk_reset_action action) 23 - { 24 - struct clk_hw *hw = __clk_get_hw(clk); 25 - struct msm_clk *m = to_msm_clk(hw); 26 - return m->reset(hw, action); 27 - } 28 - EXPORT_SYMBOL(clk_reset);
-43
arch/arm/mach-msm/clock.h
··· 1 - /* arch/arm/mach-msm/clock.h 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * Copyright (c) 2007-2012, The Linux Foundation. All rights reserved. 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - 17 - #ifndef __ARCH_ARM_MACH_MSM_CLOCK_H 18 - #define __ARCH_ARM_MACH_MSM_CLOCK_H 19 - 20 - #include <linux/clk-provider.h> 21 - #include <mach/clk.h> 22 - 23 - #define CLK_FIRST_AVAILABLE_FLAG 0x00000100 24 - #define CLKFLAG_AUTO_OFF 0x00000200 25 - #define CLKFLAG_MIN 0x00000400 26 - #define CLKFLAG_MAX 0x00000800 27 - 28 - #define OFF CLKFLAG_AUTO_OFF 29 - #define CLK_MIN CLKFLAG_MIN 30 - #define CLK_MAX CLKFLAG_MAX 31 - #define CLK_MINMAX (CLK_MIN | CLK_MAX) 32 - 33 - struct msm_clk { 34 - int (*reset)(struct clk_hw *hw, enum clk_reset_action action); 35 - struct clk_hw hw; 36 - }; 37 - 38 - static inline struct msm_clk *to_msm_clk(struct clk_hw *hw) 39 - { 40 - return container_of(hw, struct msm_clk, hw); 41 - } 42 - 43 - #endif
-41
arch/arm/mach-msm/common.h
··· 1 - /* Copyright (c) 2012, The Linux Foundation. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - */ 12 - #ifndef __MACH_COMMON_H 13 - #define __MACH_COMMON_H 14 - 15 - extern void msm7x01_timer_init(void); 16 - extern void msm7x30_timer_init(void); 17 - extern void qsd8x50_timer_init(void); 18 - 19 - extern void msm_map_common_io(void); 20 - extern void msm_map_msm7x30_io(void); 21 - extern void msm_map_qsd8x50_io(void); 22 - 23 - extern void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size, 24 - unsigned int mtype, void *caller); 25 - 26 - struct msm_mmc_platform_data; 27 - 28 - extern void msm_add_devices(void); 29 - extern void msm_init_irq(void); 30 - extern void msm_init_gpio(void); 31 - extern int msm_add_sdcc(unsigned int controller, 32 - struct msm_mmc_platform_data *plat, 33 - unsigned int stat_irq, unsigned long stat_irq_flags); 34 - 35 - #if defined(CONFIG_MSM_SMD) && defined(CONFIG_DEBUG_FS) 36 - extern int smd_debugfs_init(void); 37 - #else 38 - static inline int smd_debugfs_init(void) { return 0; } 39 - #endif 40 - 41 - #endif
-480
arch/arm/mach-msm/devices-msm7x00.c
··· 1 - /* linux/arch/arm/mach-msm/devices.c 2 - * 3 - * Copyright (C) 2008 Google, Inc. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #include <linux/kernel.h> 17 - #include <linux/platform_device.h> 18 - #include <linux/clkdev.h> 19 - 20 - #include <mach/irqs.h> 21 - #include <mach/msm_iomap.h> 22 - #include "devices.h" 23 - 24 - #include <asm/mach/flash.h> 25 - #include <linux/mtd/nand.h> 26 - #include <linux/mtd/partitions.h> 27 - 28 - #include "clock.h" 29 - #include "clock-pcom.h" 30 - #include <linux/platform_data/mmc-msm_sdcc.h> 31 - 32 - static struct resource msm_gpio_resources[] = { 33 - { 34 - .start = 32 + 0, 35 - .end = 32 + 0, 36 - .flags = IORESOURCE_IRQ, 37 - }, 38 - { 39 - .start = 32 + 1, 40 - .end = 32 + 1, 41 - .flags = IORESOURCE_IRQ, 42 - }, 43 - { 44 - .start = 0xa9200800, 45 - .end = 0xa9200800 + SZ_4K - 1, 46 - .flags = IORESOURCE_MEM, 47 - .name = "gpio1" 48 - }, 49 - { 50 - .start = 0xa9300C00, 51 - .end = 0xa9300C00 + SZ_4K - 1, 52 - .flags = IORESOURCE_MEM, 53 - .name = "gpio2" 54 - }, 55 - }; 56 - 57 - struct platform_device msm_device_gpio_7201 = { 58 - .name = "gpio-msm-7201", 59 - .num_resources = ARRAY_SIZE(msm_gpio_resources), 60 - .resource = msm_gpio_resources, 61 - }; 62 - 63 - static struct resource resources_uart1[] = { 64 - { 65 - .start = INT_UART1, 66 - .end = INT_UART1, 67 - .flags = IORESOURCE_IRQ, 68 - }, 69 - { 70 - .start = MSM_UART1_PHYS, 71 - .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1, 72 - .flags = IORESOURCE_MEM, 73 - .name = "uart_resource" 74 - }, 75 - }; 76 - 77 - static struct resource resources_uart2[] = { 78 - { 79 - .start = INT_UART2, 80 - .end = INT_UART2, 81 - .flags = IORESOURCE_IRQ, 82 - }, 83 - { 84 - .start = MSM_UART2_PHYS, 85 - .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1, 86 - .flags = IORESOURCE_MEM, 87 - .name = "uart_resource" 88 - }, 89 - }; 90 - 91 - static struct resource resources_uart3[] = { 92 - { 93 - .start = INT_UART3, 94 - .end = INT_UART3, 95 - .flags = IORESOURCE_IRQ, 96 - }, 97 - { 98 - .start = MSM_UART3_PHYS, 99 - .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1, 100 - .flags = IORESOURCE_MEM, 101 - .name = "uart_resource" 102 - }, 103 - }; 104 - 105 - struct platform_device msm_device_uart1 = { 106 - .name = "msm_serial", 107 - .id = 0, 108 - .num_resources = ARRAY_SIZE(resources_uart1), 109 - .resource = resources_uart1, 110 - }; 111 - 112 - struct platform_device msm_device_uart2 = { 113 - .name = "msm_serial", 114 - .id = 1, 115 - .num_resources = ARRAY_SIZE(resources_uart2), 116 - .resource = resources_uart2, 117 - }; 118 - 119 - struct platform_device msm_device_uart3 = { 120 - .name = "msm_serial", 121 - .id = 2, 122 - .num_resources = ARRAY_SIZE(resources_uart3), 123 - .resource = resources_uart3, 124 - }; 125 - 126 - static struct resource resources_i2c[] = { 127 - { 128 - .start = MSM_I2C_PHYS, 129 - .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1, 130 - .flags = IORESOURCE_MEM, 131 - }, 132 - { 133 - .start = INT_PWB_I2C, 134 - .end = INT_PWB_I2C, 135 - .flags = IORESOURCE_IRQ, 136 - }, 137 - }; 138 - 139 - struct platform_device msm_device_i2c = { 140 - .name = "msm_i2c", 141 - .id = 0, 142 - .num_resources = ARRAY_SIZE(resources_i2c), 143 - .resource = resources_i2c, 144 - }; 145 - 146 - static struct resource resources_hsusb[] = { 147 - { 148 - .start = MSM_HSUSB_PHYS, 149 - .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE, 150 - .flags = IORESOURCE_MEM, 151 - }, 152 - { 153 - .start = INT_USB_HS, 154 - .end = INT_USB_HS, 155 - .flags = IORESOURCE_IRQ, 156 - }, 157 - }; 158 - 159 - struct platform_device msm_device_hsusb = { 160 - .name = "msm_hsusb", 161 - .id = -1, 162 - .num_resources = ARRAY_SIZE(resources_hsusb), 163 - .resource = resources_hsusb, 164 - .dev = { 165 - .coherent_dma_mask = 0xffffffff, 166 - }, 167 - }; 168 - 169 - struct flash_platform_data msm_nand_data = { 170 - .parts = NULL, 171 - .nr_parts = 0, 172 - }; 173 - 174 - static struct resource resources_nand[] = { 175 - [0] = { 176 - .start = 7, 177 - .end = 7, 178 - .flags = IORESOURCE_DMA, 179 - }, 180 - }; 181 - 182 - struct platform_device msm_device_nand = { 183 - .name = "msm_nand", 184 - .id = -1, 185 - .num_resources = ARRAY_SIZE(resources_nand), 186 - .resource = resources_nand, 187 - .dev = { 188 - .platform_data = &msm_nand_data, 189 - }, 190 - }; 191 - 192 - struct platform_device msm_device_smd = { 193 - .name = "msm_smd", 194 - .id = -1, 195 - }; 196 - 197 - static struct resource resources_sdc1[] = { 198 - { 199 - .start = MSM_SDC1_PHYS, 200 - .end = MSM_SDC1_PHYS + MSM_SDC1_SIZE - 1, 201 - .flags = IORESOURCE_MEM, 202 - }, 203 - { 204 - .start = INT_SDC1_0, 205 - .end = INT_SDC1_0, 206 - .flags = IORESOURCE_IRQ, 207 - .name = "cmd_irq", 208 - }, 209 - { 210 - .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, 211 - .name = "status_irq" 212 - }, 213 - { 214 - .start = 8, 215 - .end = 8, 216 - .flags = IORESOURCE_DMA, 217 - }, 218 - }; 219 - 220 - static struct resource resources_sdc2[] = { 221 - { 222 - .start = MSM_SDC2_PHYS, 223 - .end = MSM_SDC2_PHYS + MSM_SDC2_SIZE - 1, 224 - .flags = IORESOURCE_MEM, 225 - }, 226 - { 227 - .start = INT_SDC2_0, 228 - .end = INT_SDC2_0, 229 - .flags = IORESOURCE_IRQ, 230 - .name = "cmd_irq", 231 - }, 232 - { 233 - .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, 234 - .name = "status_irq" 235 - }, 236 - { 237 - .start = 8, 238 - .end = 8, 239 - .flags = IORESOURCE_DMA, 240 - }, 241 - }; 242 - 243 - static struct resource resources_sdc3[] = { 244 - { 245 - .start = MSM_SDC3_PHYS, 246 - .end = MSM_SDC3_PHYS + MSM_SDC3_SIZE - 1, 247 - .flags = IORESOURCE_MEM, 248 - }, 249 - { 250 - .start = INT_SDC3_0, 251 - .end = INT_SDC3_0, 252 - .flags = IORESOURCE_IRQ, 253 - .name = "cmd_irq", 254 - }, 255 - { 256 - .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, 257 - .name = "status_irq" 258 - }, 259 - { 260 - .start = 8, 261 - .end = 8, 262 - .flags = IORESOURCE_DMA, 263 - }, 264 - }; 265 - 266 - static struct resource resources_sdc4[] = { 267 - { 268 - .start = MSM_SDC4_PHYS, 269 - .end = MSM_SDC4_PHYS + MSM_SDC4_SIZE - 1, 270 - .flags = IORESOURCE_MEM, 271 - }, 272 - { 273 - .start = INT_SDC4_0, 274 - .end = INT_SDC4_0, 275 - .flags = IORESOURCE_IRQ, 276 - .name = "cmd_irq", 277 - }, 278 - { 279 - .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, 280 - .name = "status_irq" 281 - }, 282 - { 283 - .start = 8, 284 - .end = 8, 285 - .flags = IORESOURCE_DMA, 286 - }, 287 - }; 288 - 289 - struct platform_device msm_device_sdc1 = { 290 - .name = "msm_sdcc", 291 - .id = 1, 292 - .num_resources = ARRAY_SIZE(resources_sdc1), 293 - .resource = resources_sdc1, 294 - .dev = { 295 - .coherent_dma_mask = 0xffffffff, 296 - }, 297 - }; 298 - 299 - struct platform_device msm_device_sdc2 = { 300 - .name = "msm_sdcc", 301 - .id = 2, 302 - .num_resources = ARRAY_SIZE(resources_sdc2), 303 - .resource = resources_sdc2, 304 - .dev = { 305 - .coherent_dma_mask = 0xffffffff, 306 - }, 307 - }; 308 - 309 - struct platform_device msm_device_sdc3 = { 310 - .name = "msm_sdcc", 311 - .id = 3, 312 - .num_resources = ARRAY_SIZE(resources_sdc3), 313 - .resource = resources_sdc3, 314 - .dev = { 315 - .coherent_dma_mask = 0xffffffff, 316 - }, 317 - }; 318 - 319 - struct platform_device msm_device_sdc4 = { 320 - .name = "msm_sdcc", 321 - .id = 4, 322 - .num_resources = ARRAY_SIZE(resources_sdc4), 323 - .resource = resources_sdc4, 324 - .dev = { 325 - .coherent_dma_mask = 0xffffffff, 326 - }, 327 - }; 328 - 329 - static struct platform_device *msm_sdcc_devices[] __initdata = { 330 - &msm_device_sdc1, 331 - &msm_device_sdc2, 332 - &msm_device_sdc3, 333 - &msm_device_sdc4, 334 - }; 335 - 336 - int __init msm_add_sdcc(unsigned int controller, 337 - struct msm_mmc_platform_data *plat, 338 - unsigned int stat_irq, unsigned long stat_irq_flags) 339 - { 340 - struct platform_device *pdev; 341 - struct resource *res; 342 - 343 - if (controller < 1 || controller > 4) 344 - return -EINVAL; 345 - 346 - pdev = msm_sdcc_devices[controller-1]; 347 - pdev->dev.platform_data = plat; 348 - 349 - res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "status_irq"); 350 - if (!res) 351 - return -EINVAL; 352 - else if (stat_irq) { 353 - res->start = res->end = stat_irq; 354 - res->flags &= ~IORESOURCE_DISABLED; 355 - res->flags |= stat_irq_flags; 356 - } 357 - 358 - return platform_device_register(pdev); 359 - } 360 - 361 - static struct resource resources_mddi0[] = { 362 - { 363 - .start = MSM_PMDH_PHYS, 364 - .end = MSM_PMDH_PHYS + MSM_PMDH_SIZE - 1, 365 - .flags = IORESOURCE_MEM, 366 - }, 367 - { 368 - .start = INT_MDDI_PRI, 369 - .end = INT_MDDI_PRI, 370 - .flags = IORESOURCE_IRQ, 371 - }, 372 - }; 373 - 374 - static struct resource resources_mddi1[] = { 375 - { 376 - .start = MSM_EMDH_PHYS, 377 - .end = MSM_EMDH_PHYS + MSM_EMDH_SIZE - 1, 378 - .flags = IORESOURCE_MEM, 379 - }, 380 - { 381 - .start = INT_MDDI_EXT, 382 - .end = INT_MDDI_EXT, 383 - .flags = IORESOURCE_IRQ, 384 - }, 385 - }; 386 - 387 - struct platform_device msm_device_mddi0 = { 388 - .name = "msm_mddi", 389 - .id = 0, 390 - .num_resources = ARRAY_SIZE(resources_mddi0), 391 - .resource = resources_mddi0, 392 - .dev = { 393 - .coherent_dma_mask = 0xffffffff, 394 - }, 395 - }; 396 - 397 - struct platform_device msm_device_mddi1 = { 398 - .name = "msm_mddi", 399 - .id = 1, 400 - .num_resources = ARRAY_SIZE(resources_mddi1), 401 - .resource = resources_mddi1, 402 - .dev = { 403 - .coherent_dma_mask = 0xffffffff, 404 - }, 405 - }; 406 - 407 - static struct resource resources_mdp[] = { 408 - { 409 - .start = MSM_MDP_PHYS, 410 - .end = MSM_MDP_PHYS + MSM_MDP_SIZE - 1, 411 - .name = "mdp", 412 - .flags = IORESOURCE_MEM 413 - }, 414 - { 415 - .start = INT_MDP, 416 - .end = INT_MDP, 417 - .flags = IORESOURCE_IRQ, 418 - }, 419 - }; 420 - 421 - struct platform_device msm_device_mdp = { 422 - .name = "msm_mdp", 423 - .id = 0, 424 - .num_resources = ARRAY_SIZE(resources_mdp), 425 - .resource = resources_mdp, 426 - }; 427 - 428 - static struct clk_pcom_desc msm_clocks_7x01a[] = { 429 - CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 430 - CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), 431 - CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, 0), 432 - CLK_PCOM("ebi2_clk", EBI2_CLK, NULL, 0), 433 - CLK_PCOM("ecodec_clk", ECODEC_CLK, NULL, 0), 434 - CLK_PCOM("emdh_clk", EMDH_CLK, NULL, OFF), 435 - CLK_PCOM("gp_clk", GP_CLK, NULL, 0), 436 - CLK_PCOM("grp_clk", GRP_3D_CLK, NULL, OFF), 437 - CLK_PCOM("i2c_clk", I2C_CLK, "msm_i2c.0", 0), 438 - CLK_PCOM("icodec_rx_clk", ICODEC_RX_CLK, NULL, 0), 439 - CLK_PCOM("icodec_tx_clk", ICODEC_TX_CLK, NULL, 0), 440 - CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF), 441 - CLK_PCOM("mdc_clk", MDC_CLK, NULL, 0), 442 - CLK_PCOM("mdp_clk", MDP_CLK, NULL, OFF), 443 - CLK_PCOM("pbus_clk", PBUS_CLK, NULL, 0), 444 - CLK_PCOM("pcm_clk", PCM_CLK, NULL, 0), 445 - CLK_PCOM("mddi_clk", PMDH_CLK, NULL, OFF | CLK_MINMAX), 446 - CLK_PCOM("sdac_clk", SDAC_CLK, NULL, OFF), 447 - CLK_PCOM("sdc_clk", SDC1_CLK, "msm_sdcc.1", OFF), 448 - CLK_PCOM("sdc_pclk", SDC1_P_CLK, "msm_sdcc.1", OFF), 449 - CLK_PCOM("sdc_clk", SDC2_CLK, "msm_sdcc.2", OFF), 450 - CLK_PCOM("sdc_pclk", SDC2_P_CLK, "msm_sdcc.2", OFF), 451 - CLK_PCOM("sdc_clk", SDC3_CLK, "msm_sdcc.3", OFF), 452 - CLK_PCOM("sdc_pclk", SDC3_P_CLK, "msm_sdcc.3", OFF), 453 - CLK_PCOM("sdc_clk", SDC4_CLK, "msm_sdcc.4", OFF), 454 - CLK_PCOM("sdc_pclk", SDC4_P_CLK, "msm_sdcc.4", OFF), 455 - CLK_PCOM("tsif_clk", TSIF_CLK, NULL, 0), 456 - CLK_PCOM("tsif_ref_clk", TSIF_REF_CLK, NULL, 0), 457 - CLK_PCOM("tv_dac_clk", TV_DAC_CLK, NULL, 0), 458 - CLK_PCOM("tv_enc_clk", TV_ENC_CLK, NULL, 0), 459 - CLK_PCOM("core", UART1_CLK, "msm_serial.0", OFF), 460 - CLK_PCOM("core", UART2_CLK, "msm_serial.1", 0), 461 - CLK_PCOM("core", UART3_CLK, "msm_serial.2", OFF), 462 - CLK_PCOM("uart1dm_clk", UART1DM_CLK, NULL, OFF), 463 - CLK_PCOM("uart2dm_clk", UART2DM_CLK, NULL, 0), 464 - CLK_PCOM("usb_hs_clk", USB_HS_CLK, "msm_hsusb", OFF), 465 - CLK_PCOM("usb_hs_pclk", USB_HS_P_CLK, "msm_hsusb", OFF), 466 - CLK_PCOM("usb_otg_clk", USB_OTG_CLK, NULL, 0), 467 - CLK_PCOM("vdc_clk", VDC_CLK, NULL, OFF ), 468 - CLK_PCOM("vfe_clk", VFE_CLK, NULL, OFF), 469 - CLK_PCOM("vfe_mdc_clk", VFE_MDC_CLK, NULL, OFF), 470 - }; 471 - 472 - static struct pcom_clk_pdata msm_clock_7x01a_pdata = { 473 - .lookup = msm_clocks_7x01a, 474 - .num_lookups = ARRAY_SIZE(msm_clocks_7x01a), 475 - }; 476 - 477 - struct platform_device msm_clock_7x01a = { 478 - .name = "msm-clock-pcom", 479 - .dev.platform_data = &msm_clock_7x01a_pdata, 480 - };
-246
arch/arm/mach-msm/devices-msm7x30.c
··· 1 - /* 2 - * Copyright (C) 2008 Google, Inc. 3 - * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #include <linux/kernel.h> 17 - #include <linux/platform_device.h> 18 - 19 - #include <linux/dma-mapping.h> 20 - #include <linux/clkdev.h> 21 - #include <mach/irqs.h> 22 - #include <mach/msm_iomap.h> 23 - #include <mach/dma.h> 24 - 25 - #include "devices.h" 26 - #include "smd_private.h" 27 - #include "common.h" 28 - 29 - #include <asm/mach/flash.h> 30 - 31 - #include "clock.h" 32 - #include "clock-pcom.h" 33 - 34 - #include <linux/platform_data/mmc-msm_sdcc.h> 35 - 36 - static struct resource msm_gpio_resources[] = { 37 - { 38 - .start = 32 + 18, 39 - .end = 32 + 18, 40 - .flags = IORESOURCE_IRQ, 41 - }, 42 - { 43 - .start = 32 + 19, 44 - .end = 32 + 19, 45 - .flags = IORESOURCE_IRQ, 46 - }, 47 - { 48 - .start = 0xac001000, 49 - .end = 0xac001000 + SZ_4K - 1, 50 - .flags = IORESOURCE_MEM, 51 - .name = "gpio1" 52 - }, 53 - { 54 - .start = 0xac101400, 55 - .end = 0xac101400 + SZ_4K - 1, 56 - .flags = IORESOURCE_MEM, 57 - .name = "gpio2" 58 - }, 59 - }; 60 - 61 - struct platform_device msm_device_gpio_7x30 = { 62 - .name = "gpio-msm-7x30", 63 - .num_resources = ARRAY_SIZE(msm_gpio_resources), 64 - .resource = msm_gpio_resources, 65 - }; 66 - 67 - static struct resource resources_uart2[] = { 68 - { 69 - .start = INT_UART2, 70 - .end = INT_UART2, 71 - .flags = IORESOURCE_IRQ, 72 - }, 73 - { 74 - .start = MSM_UART2_PHYS, 75 - .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1, 76 - .flags = IORESOURCE_MEM, 77 - .name = "uart_resource" 78 - }, 79 - }; 80 - 81 - struct platform_device msm_device_uart2 = { 82 - .name = "msm_serial", 83 - .id = 1, 84 - .num_resources = ARRAY_SIZE(resources_uart2), 85 - .resource = resources_uart2, 86 - }; 87 - 88 - struct platform_device msm_device_smd = { 89 - .name = "msm_smd", 90 - .id = -1, 91 - }; 92 - 93 - static struct resource resources_otg[] = { 94 - { 95 - .start = MSM_HSUSB_PHYS, 96 - .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE, 97 - .flags = IORESOURCE_MEM, 98 - }, 99 - { 100 - .start = INT_USB_HS, 101 - .end = INT_USB_HS, 102 - .flags = IORESOURCE_IRQ, 103 - }, 104 - }; 105 - 106 - struct platform_device msm_device_otg = { 107 - .name = "msm_otg", 108 - .id = -1, 109 - .num_resources = ARRAY_SIZE(resources_otg), 110 - .resource = resources_otg, 111 - .dev = { 112 - .coherent_dma_mask = 0xffffffff, 113 - }, 114 - }; 115 - 116 - static struct resource resources_hsusb[] = { 117 - { 118 - .start = MSM_HSUSB_PHYS, 119 - .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE, 120 - .flags = IORESOURCE_MEM, 121 - }, 122 - { 123 - .start = INT_USB_HS, 124 - .end = INT_USB_HS, 125 - .flags = IORESOURCE_IRQ, 126 - }, 127 - }; 128 - 129 - struct platform_device msm_device_hsusb = { 130 - .name = "msm_hsusb", 131 - .id = -1, 132 - .num_resources = ARRAY_SIZE(resources_hsusb), 133 - .resource = resources_hsusb, 134 - .dev = { 135 - .coherent_dma_mask = 0xffffffff, 136 - }, 137 - }; 138 - 139 - static u64 dma_mask = 0xffffffffULL; 140 - static struct resource resources_hsusb_host[] = { 141 - { 142 - .start = MSM_HSUSB_PHYS, 143 - .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE, 144 - .flags = IORESOURCE_MEM, 145 - }, 146 - { 147 - .start = INT_USB_HS, 148 - .end = INT_USB_HS, 149 - .flags = IORESOURCE_IRQ, 150 - }, 151 - }; 152 - 153 - struct platform_device msm_device_hsusb_host = { 154 - .name = "msm_hsusb_host", 155 - .id = -1, 156 - .num_resources = ARRAY_SIZE(resources_hsusb_host), 157 - .resource = resources_hsusb_host, 158 - .dev = { 159 - .dma_mask = &dma_mask, 160 - .coherent_dma_mask = 0xffffffffULL, 161 - }, 162 - }; 163 - 164 - static struct clk_pcom_desc msm_clocks_7x30[] = { 165 - CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 166 - CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), 167 - CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0), 168 - CLK_PCOM("camif_pad_pclk", CAMIF_PAD_P_CLK, NULL, OFF), 169 - CLK_PCOM("ce_clk", CE_CLK, NULL, 0), 170 - CLK_PCOM("codec_ssbi_clk", CODEC_SSBI_CLK, NULL, 0), 171 - CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN), 172 - CLK_PCOM("ecodec_clk", ECODEC_CLK, NULL, 0), 173 - CLK_PCOM("emdh_clk", EMDH_CLK, NULL, OFF | CLK_MINMAX), 174 - CLK_PCOM("emdh_pclk", EMDH_P_CLK, NULL, OFF), 175 - CLK_PCOM("gp_clk", GP_CLK, NULL, 0), 176 - CLK_PCOM("grp_2d_clk", GRP_2D_CLK, NULL, 0), 177 - CLK_PCOM("grp_2d_pclk", GRP_2D_P_CLK, NULL, 0), 178 - CLK_PCOM("grp_clk", GRP_3D_CLK, NULL, 0), 179 - CLK_PCOM("grp_pclk", GRP_3D_P_CLK, NULL, 0), 180 - CLK_PCOM("hdmi_clk", HDMI_CLK, NULL, 0), 181 - CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF), 182 - CLK_PCOM("jpeg_clk", JPEG_CLK, NULL, OFF), 183 - CLK_PCOM("jpeg_pclk", JPEG_P_CLK, NULL, OFF), 184 - CLK_PCOM("lpa_codec_clk", LPA_CODEC_CLK, NULL, 0), 185 - CLK_PCOM("lpa_core_clk", LPA_CORE_CLK, NULL, 0), 186 - CLK_PCOM("lpa_pclk", LPA_P_CLK, NULL, 0), 187 - CLK_PCOM("mdc_clk", MDC_CLK, NULL, 0), 188 - CLK_PCOM("mddi_clk", PMDH_CLK, NULL, OFF | CLK_MINMAX), 189 - CLK_PCOM("mddi_pclk", PMDH_P_CLK, NULL, 0), 190 - CLK_PCOM("mdp_clk", MDP_CLK, NULL, OFF), 191 - CLK_PCOM("mdp_pclk", MDP_P_CLK, NULL, 0), 192 - CLK_PCOM("mdp_lcdc_pclk_clk", MDP_LCDC_PCLK_CLK, NULL, 0), 193 - CLK_PCOM("mdp_lcdc_pad_pclk_clk", MDP_LCDC_PAD_PCLK_CLK, NULL, 0), 194 - CLK_PCOM("mdp_vsync_clk", MDP_VSYNC_CLK, NULL, 0), 195 - CLK_PCOM("mfc_clk", MFC_CLK, NULL, 0), 196 - CLK_PCOM("mfc_div2_clk", MFC_DIV2_CLK, NULL, 0), 197 - CLK_PCOM("mfc_pclk", MFC_P_CLK, NULL, 0), 198 - CLK_PCOM("mi2s_m_clk", MI2S_M_CLK, NULL, 0), 199 - CLK_PCOM("mi2s_s_clk", MI2S_S_CLK, NULL, 0), 200 - CLK_PCOM("mi2s_codec_rx_m_clk", MI2S_CODEC_RX_M_CLK, NULL, 0), 201 - CLK_PCOM("mi2s_codec_rx_s_clk", MI2S_CODEC_RX_S_CLK, NULL, 0), 202 - CLK_PCOM("mi2s_codec_tx_m_clk", MI2S_CODEC_TX_M_CLK, NULL, 0), 203 - CLK_PCOM("mi2s_codec_tx_s_clk", MI2S_CODEC_TX_S_CLK, NULL, 0), 204 - CLK_PCOM("pbus_clk", PBUS_CLK, NULL, CLK_MIN), 205 - CLK_PCOM("pcm_clk", PCM_CLK, NULL, 0), 206 - CLK_PCOM("rotator_clk", AXI_ROTATOR_CLK, NULL, 0), 207 - CLK_PCOM("rotator_imem_clk", ROTATOR_IMEM_CLK, NULL, OFF), 208 - CLK_PCOM("rotator_pclk", ROTATOR_P_CLK, NULL, OFF), 209 - CLK_PCOM("sdac_clk", SDAC_CLK, NULL, OFF), 210 - CLK_PCOM("spi_clk", SPI_CLK, NULL, 0), 211 - CLK_PCOM("spi_pclk", SPI_P_CLK, NULL, 0), 212 - CLK_PCOM("tv_dac_clk", TV_DAC_CLK, NULL, 0), 213 - CLK_PCOM("tv_enc_clk", TV_ENC_CLK, NULL, 0), 214 - CLK_PCOM("core", UART2_CLK, "msm_serial.1", 0), 215 - CLK_PCOM("usb_phy_clk", USB_PHY_CLK, NULL, 0), 216 - CLK_PCOM("usb_hs_clk", USB_HS_CLK, NULL, OFF), 217 - CLK_PCOM("usb_hs_pclk", USB_HS_P_CLK, NULL, OFF), 218 - CLK_PCOM("usb_hs_core_clk", USB_HS_CORE_CLK, NULL, OFF), 219 - CLK_PCOM("usb_hs2_clk", USB_HS2_CLK, NULL, OFF), 220 - CLK_PCOM("usb_hs2_pclk", USB_HS2_P_CLK, NULL, OFF), 221 - CLK_PCOM("usb_hs2_core_clk", USB_HS2_CORE_CLK, NULL, OFF), 222 - CLK_PCOM("usb_hs3_clk", USB_HS3_CLK, NULL, OFF), 223 - CLK_PCOM("usb_hs3_pclk", USB_HS3_P_CLK, NULL, OFF), 224 - CLK_PCOM("usb_hs3_core_clk", USB_HS3_CORE_CLK, NULL, OFF), 225 - CLK_PCOM("vdc_clk", VDC_CLK, NULL, OFF | CLK_MIN), 226 - CLK_PCOM("vfe_camif_clk", VFE_CAMIF_CLK, NULL, 0), 227 - CLK_PCOM("vfe_clk", VFE_CLK, NULL, 0), 228 - CLK_PCOM("vfe_mdc_clk", VFE_MDC_CLK, NULL, 0), 229 - CLK_PCOM("vfe_pclk", VFE_P_CLK, NULL, OFF), 230 - CLK_PCOM("vpe_clk", VPE_CLK, NULL, 0), 231 - 232 - /* 7x30 v2 hardware only. */ 233 - CLK_PCOM("csi_clk", CSI0_CLK, NULL, 0), 234 - CLK_PCOM("csi_pclk", CSI0_P_CLK, NULL, 0), 235 - CLK_PCOM("csi_vfe_clk", CSI0_VFE_CLK, NULL, 0), 236 - }; 237 - 238 - static struct pcom_clk_pdata msm_clock_7x30_pdata = { 239 - .lookup = msm_clocks_7x30, 240 - .num_lookups = ARRAY_SIZE(msm_clocks_7x30), 241 - }; 242 - 243 - struct platform_device msm_clock_7x30 = { 244 - .name = "msm-clock-pcom", 245 - .dev.platform_data = &msm_clock_7x30_pdata, 246 - };
-388
arch/arm/mach-msm/devices-qsd8x50.c
··· 1 - /* 2 - * Copyright (C) 2008 Google, Inc. 3 - * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #include <linux/kernel.h> 17 - #include <linux/platform_device.h> 18 - #include <linux/clkdev.h> 19 - #include <linux/dma-mapping.h> 20 - 21 - #include <mach/irqs.h> 22 - #include <mach/msm_iomap.h> 23 - #include <mach/dma.h> 24 - 25 - #include "devices.h" 26 - #include "common.h" 27 - 28 - #include <asm/mach/flash.h> 29 - 30 - #include <linux/platform_data/mmc-msm_sdcc.h> 31 - #include "clock.h" 32 - #include "clock-pcom.h" 33 - 34 - static struct resource msm_gpio_resources[] = { 35 - { 36 - .start = 64 + 165 + 9, 37 - .end = 64 + 165 + 9, 38 - .flags = IORESOURCE_IRQ, 39 - }, 40 - { 41 - .start = 64 + 165 + 10, 42 - .end = 64 + 165 + 10, 43 - .flags = IORESOURCE_IRQ, 44 - }, 45 - { 46 - .start = 0xa9000800, 47 - .end = 0xa9000800 + SZ_4K - 1, 48 - .flags = IORESOURCE_MEM, 49 - .name = "gpio1" 50 - }, 51 - { 52 - .start = 0xa9100C00, 53 - .end = 0xa9100C00 + SZ_4K - 1, 54 - .flags = IORESOURCE_MEM, 55 - .name = "gpio2" 56 - }, 57 - }; 58 - 59 - struct platform_device msm_device_gpio_8x50 = { 60 - .name = "gpio-msm-8x50", 61 - .num_resources = ARRAY_SIZE(msm_gpio_resources), 62 - .resource = msm_gpio_resources, 63 - }; 64 - 65 - static struct resource resources_uart3[] = { 66 - { 67 - .start = INT_UART3, 68 - .end = INT_UART3, 69 - .flags = IORESOURCE_IRQ, 70 - }, 71 - { 72 - .start = MSM_UART3_PHYS, 73 - .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1, 74 - .flags = IORESOURCE_MEM, 75 - .name = "uart_resource" 76 - }, 77 - }; 78 - 79 - struct platform_device msm_device_uart3 = { 80 - .name = "msm_serial", 81 - .id = 2, 82 - .num_resources = ARRAY_SIZE(resources_uart3), 83 - .resource = resources_uart3, 84 - }; 85 - 86 - struct platform_device msm_device_smd = { 87 - .name = "msm_smd", 88 - .id = -1, 89 - }; 90 - 91 - static struct resource resources_otg[] = { 92 - { 93 - .start = MSM_HSUSB_PHYS, 94 - .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE, 95 - .flags = IORESOURCE_MEM, 96 - }, 97 - { 98 - .start = INT_USB_HS, 99 - .end = INT_USB_HS, 100 - .flags = IORESOURCE_IRQ, 101 - }, 102 - }; 103 - 104 - struct platform_device msm_device_otg = { 105 - .name = "msm_otg", 106 - .id = -1, 107 - .num_resources = ARRAY_SIZE(resources_otg), 108 - .resource = resources_otg, 109 - .dev = { 110 - .coherent_dma_mask = 0xffffffff, 111 - }, 112 - }; 113 - 114 - static struct resource resources_hsusb[] = { 115 - { 116 - .start = MSM_HSUSB_PHYS, 117 - .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE, 118 - .flags = IORESOURCE_MEM, 119 - }, 120 - { 121 - .start = INT_USB_HS, 122 - .end = INT_USB_HS, 123 - .flags = IORESOURCE_IRQ, 124 - }, 125 - }; 126 - 127 - struct platform_device msm_device_hsusb = { 128 - .name = "msm_hsusb", 129 - .id = -1, 130 - .num_resources = ARRAY_SIZE(resources_hsusb), 131 - .resource = resources_hsusb, 132 - .dev = { 133 - .coherent_dma_mask = 0xffffffff, 134 - }, 135 - }; 136 - 137 - static u64 dma_mask = 0xffffffffULL; 138 - static struct resource resources_hsusb_host[] = { 139 - { 140 - .start = MSM_HSUSB_PHYS, 141 - .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE, 142 - .flags = IORESOURCE_MEM, 143 - }, 144 - { 145 - .start = INT_USB_HS, 146 - .end = INT_USB_HS, 147 - .flags = IORESOURCE_IRQ, 148 - }, 149 - }; 150 - 151 - struct platform_device msm_device_hsusb_host = { 152 - .name = "msm_hsusb_host", 153 - .id = -1, 154 - .num_resources = ARRAY_SIZE(resources_hsusb_host), 155 - .resource = resources_hsusb_host, 156 - .dev = { 157 - .dma_mask = &dma_mask, 158 - .coherent_dma_mask = 0xffffffffULL, 159 - }, 160 - }; 161 - 162 - static struct resource resources_sdc1[] = { 163 - { 164 - .start = MSM_SDC1_PHYS, 165 - .end = MSM_SDC1_PHYS + MSM_SDC1_SIZE - 1, 166 - .flags = IORESOURCE_MEM, 167 - }, 168 - { 169 - .start = INT_SDC1_0, 170 - .end = INT_SDC1_0, 171 - .flags = IORESOURCE_IRQ, 172 - .name = "cmd_irq", 173 - }, 174 - { 175 - .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, 176 - .name = "status_irq" 177 - }, 178 - { 179 - .start = 8, 180 - .end = 8, 181 - .flags = IORESOURCE_DMA, 182 - }, 183 - }; 184 - 185 - static struct resource resources_sdc2[] = { 186 - { 187 - .start = MSM_SDC2_PHYS, 188 - .end = MSM_SDC2_PHYS + MSM_SDC2_SIZE - 1, 189 - .flags = IORESOURCE_MEM, 190 - }, 191 - { 192 - .start = INT_SDC2_0, 193 - .end = INT_SDC2_0, 194 - .flags = IORESOURCE_IRQ, 195 - .name = "cmd_irq", 196 - }, 197 - { 198 - .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, 199 - .name = "status_irq" 200 - }, 201 - { 202 - .start = 8, 203 - .end = 8, 204 - .flags = IORESOURCE_DMA, 205 - }, 206 - }; 207 - 208 - static struct resource resources_sdc3[] = { 209 - { 210 - .start = MSM_SDC3_PHYS, 211 - .end = MSM_SDC3_PHYS + MSM_SDC3_SIZE - 1, 212 - .flags = IORESOURCE_MEM, 213 - }, 214 - { 215 - .start = INT_SDC3_0, 216 - .end = INT_SDC3_0, 217 - .flags = IORESOURCE_IRQ, 218 - .name = "cmd_irq", 219 - }, 220 - { 221 - .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, 222 - .name = "status_irq" 223 - }, 224 - { 225 - .start = 8, 226 - .end = 8, 227 - .flags = IORESOURCE_DMA, 228 - }, 229 - }; 230 - 231 - static struct resource resources_sdc4[] = { 232 - { 233 - .start = MSM_SDC4_PHYS, 234 - .end = MSM_SDC4_PHYS + MSM_SDC4_SIZE - 1, 235 - .flags = IORESOURCE_MEM, 236 - }, 237 - { 238 - .start = INT_SDC4_0, 239 - .end = INT_SDC4_0, 240 - .flags = IORESOURCE_IRQ, 241 - .name = "cmd_irq", 242 - }, 243 - { 244 - .flags = IORESOURCE_IRQ | IORESOURCE_DISABLED, 245 - .name = "status_irq" 246 - }, 247 - { 248 - .start = 8, 249 - .end = 8, 250 - .flags = IORESOURCE_DMA, 251 - }, 252 - }; 253 - 254 - struct platform_device msm_device_sdc1 = { 255 - .name = "msm_sdcc", 256 - .id = 1, 257 - .num_resources = ARRAY_SIZE(resources_sdc1), 258 - .resource = resources_sdc1, 259 - .dev = { 260 - .coherent_dma_mask = 0xffffffff, 261 - }, 262 - }; 263 - 264 - struct platform_device msm_device_sdc2 = { 265 - .name = "msm_sdcc", 266 - .id = 2, 267 - .num_resources = ARRAY_SIZE(resources_sdc2), 268 - .resource = resources_sdc2, 269 - .dev = { 270 - .coherent_dma_mask = 0xffffffff, 271 - }, 272 - }; 273 - 274 - struct platform_device msm_device_sdc3 = { 275 - .name = "msm_sdcc", 276 - .id = 3, 277 - .num_resources = ARRAY_SIZE(resources_sdc3), 278 - .resource = resources_sdc3, 279 - .dev = { 280 - .coherent_dma_mask = 0xffffffff, 281 - }, 282 - }; 283 - 284 - struct platform_device msm_device_sdc4 = { 285 - .name = "msm_sdcc", 286 - .id = 4, 287 - .num_resources = ARRAY_SIZE(resources_sdc4), 288 - .resource = resources_sdc4, 289 - .dev = { 290 - .coherent_dma_mask = 0xffffffff, 291 - }, 292 - }; 293 - 294 - static struct platform_device *msm_sdcc_devices[] __initdata = { 295 - &msm_device_sdc1, 296 - &msm_device_sdc2, 297 - &msm_device_sdc3, 298 - &msm_device_sdc4, 299 - }; 300 - 301 - int __init msm_add_sdcc(unsigned int controller, 302 - struct msm_mmc_platform_data *plat, 303 - unsigned int stat_irq, unsigned long stat_irq_flags) 304 - { 305 - struct platform_device *pdev; 306 - struct resource *res; 307 - 308 - if (controller < 1 || controller > 4) 309 - return -EINVAL; 310 - 311 - pdev = msm_sdcc_devices[controller-1]; 312 - pdev->dev.platform_data = plat; 313 - 314 - res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "status_irq"); 315 - if (!res) 316 - return -EINVAL; 317 - else if (stat_irq) { 318 - res->start = res->end = stat_irq; 319 - res->flags &= ~IORESOURCE_DISABLED; 320 - res->flags |= stat_irq_flags; 321 - } 322 - 323 - return platform_device_register(pdev); 324 - } 325 - 326 - static struct clk_pcom_desc msm_clocks_8x50[] = { 327 - CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 328 - CLK_PCOM("ce_clk", CE_CLK, NULL, 0), 329 - CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN), 330 - CLK_PCOM("ebi2_clk", EBI2_CLK, NULL, 0), 331 - CLK_PCOM("ecodec_clk", ECODEC_CLK, NULL, 0), 332 - CLK_PCOM("emdh_clk", EMDH_CLK, NULL, OFF | CLK_MINMAX), 333 - CLK_PCOM("gp_clk", GP_CLK, NULL, 0), 334 - CLK_PCOM("grp_clk", GRP_3D_CLK, NULL, 0), 335 - CLK_PCOM("i2c_clk", I2C_CLK, NULL, 0), 336 - CLK_PCOM("icodec_rx_clk", ICODEC_RX_CLK, NULL, 0), 337 - CLK_PCOM("icodec_tx_clk", ICODEC_TX_CLK, NULL, 0), 338 - CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF), 339 - CLK_PCOM("mdc_clk", MDC_CLK, NULL, 0), 340 - CLK_PCOM("mddi_clk", PMDH_CLK, NULL, OFF | CLK_MINMAX), 341 - CLK_PCOM("mdp_clk", MDP_CLK, NULL, OFF), 342 - CLK_PCOM("mdp_lcdc_pclk_clk", MDP_LCDC_PCLK_CLK, NULL, 0), 343 - CLK_PCOM("mdp_lcdc_pad_pclk_clk", MDP_LCDC_PAD_PCLK_CLK, NULL, 0), 344 - CLK_PCOM("mdp_vsync_clk", MDP_VSYNC_CLK, NULL, 0), 345 - CLK_PCOM("pbus_clk", PBUS_CLK, NULL, CLK_MIN), 346 - CLK_PCOM("pcm_clk", PCM_CLK, NULL, 0), 347 - CLK_PCOM("sdac_clk", SDAC_CLK, NULL, OFF), 348 - CLK_PCOM("sdc_clk", SDC1_CLK, "msm_sdcc.1", OFF), 349 - CLK_PCOM("sdc_pclk", SDC1_P_CLK, "msm_sdcc.1", OFF), 350 - CLK_PCOM("sdc_clk", SDC2_CLK, "msm_sdcc.2", OFF), 351 - CLK_PCOM("sdc_pclk", SDC2_P_CLK, "msm_sdcc.2", OFF), 352 - CLK_PCOM("sdc_clk", SDC3_CLK, "msm_sdcc.3", OFF), 353 - CLK_PCOM("sdc_pclk", SDC3_P_CLK, "msm_sdcc.3", OFF), 354 - CLK_PCOM("sdc_clk", SDC4_CLK, "msm_sdcc.4", OFF), 355 - CLK_PCOM("sdc_pclk", SDC4_P_CLK, "msm_sdcc.4", OFF), 356 - CLK_PCOM("spi_clk", SPI_CLK, NULL, 0), 357 - CLK_PCOM("tsif_clk", TSIF_CLK, NULL, 0), 358 - CLK_PCOM("tsif_ref_clk", TSIF_REF_CLK, NULL, 0), 359 - CLK_PCOM("tv_dac_clk", TV_DAC_CLK, NULL, 0), 360 - CLK_PCOM("tv_enc_clk", TV_ENC_CLK, NULL, 0), 361 - CLK_PCOM("core", UART1_CLK, NULL, OFF), 362 - CLK_PCOM("core", UART2_CLK, NULL, 0), 363 - CLK_PCOM("core", UART3_CLK, "msm_serial.2", OFF), 364 - CLK_PCOM("uartdm_clk", UART1DM_CLK, NULL, OFF), 365 - CLK_PCOM("uartdm_clk", UART2DM_CLK, NULL, 0), 366 - CLK_PCOM("usb_hs_clk", USB_HS_CLK, NULL, OFF), 367 - CLK_PCOM("usb_hs_pclk", USB_HS_P_CLK, NULL, OFF), 368 - CLK_PCOM("usb_otg_clk", USB_OTG_CLK, NULL, 0), 369 - CLK_PCOM("vdc_clk", VDC_CLK, NULL, OFF | CLK_MIN), 370 - CLK_PCOM("vfe_clk", VFE_CLK, NULL, OFF), 371 - CLK_PCOM("vfe_mdc_clk", VFE_MDC_CLK, NULL, OFF), 372 - CLK_PCOM("vfe_axi_clk", VFE_AXI_CLK, NULL, OFF), 373 - CLK_PCOM("usb_hs2_clk", USB_HS2_CLK, NULL, OFF), 374 - CLK_PCOM("usb_hs2_pclk", USB_HS2_P_CLK, NULL, OFF), 375 - CLK_PCOM("usb_hs3_clk", USB_HS3_CLK, NULL, OFF), 376 - CLK_PCOM("usb_hs3_pclk", USB_HS3_P_CLK, NULL, OFF), 377 - CLK_PCOM("usb_phy_clk", USB_PHY_CLK, NULL, 0), 378 - }; 379 - 380 - static struct pcom_clk_pdata msm_clock_8x50_pdata = { 381 - .lookup = msm_clocks_8x50, 382 - .num_lookups = ARRAY_SIZE(msm_clocks_8x50), 383 - }; 384 - 385 - struct platform_device msm_clock_8x50 = { 386 - .name = "msm-clock-pcom", 387 - .dev.platform_data = &msm_clock_8x50_pdata, 388 - };
-53
arch/arm/mach-msm/devices.h
··· 1 - /* linux/arch/arm/mach-msm/devices.h 2 - * 3 - * Copyright (C) 2008 Google, Inc. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #ifndef __ARCH_ARM_MACH_MSM_DEVICES_H 17 - #define __ARCH_ARM_MACH_MSM_DEVICES_H 18 - 19 - extern struct platform_device msm_device_gpio_7201; 20 - extern struct platform_device msm_device_gpio_7x30; 21 - extern struct platform_device msm_device_gpio_8x50; 22 - 23 - extern struct platform_device msm_device_uart1; 24 - extern struct platform_device msm_device_uart2; 25 - extern struct platform_device msm_device_uart3; 26 - 27 - extern struct platform_device msm8960_device_uart_gsbi2; 28 - extern struct platform_device msm8960_device_uart_gsbi5; 29 - 30 - extern struct platform_device msm_device_sdc1; 31 - extern struct platform_device msm_device_sdc2; 32 - extern struct platform_device msm_device_sdc3; 33 - extern struct platform_device msm_device_sdc4; 34 - 35 - extern struct platform_device msm_device_hsusb; 36 - extern struct platform_device msm_device_otg; 37 - extern struct platform_device msm_device_hsusb_host; 38 - 39 - extern struct platform_device msm_device_i2c; 40 - 41 - extern struct platform_device msm_device_smd; 42 - 43 - extern struct platform_device msm_device_nand; 44 - 45 - extern struct platform_device msm_device_mddi0; 46 - extern struct platform_device msm_device_mddi1; 47 - extern struct platform_device msm_device_mdp; 48 - 49 - extern struct platform_device msm_clock_7x01a; 50 - extern struct platform_device msm_clock_7x30; 51 - extern struct platform_device msm_clock_8x50; 52 - 53 - #endif
-298
arch/arm/mach-msm/dma.c
··· 1 - /* linux/arch/arm/mach-msm/dma.c 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #include <linux/clk.h> 17 - #include <linux/err.h> 18 - #include <linux/io.h> 19 - #include <linux/interrupt.h> 20 - #include <linux/completion.h> 21 - #include <linux/module.h> 22 - #include <mach/dma.h> 23 - #include <mach/msm_iomap.h> 24 - 25 - #define MSM_DMOV_CHANNEL_COUNT 16 26 - 27 - #define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2)) 28 - #define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2)) 29 - #define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2)) 30 - #define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2)) 31 - 32 - #if defined(CONFIG_ARCH_MSM7X30) 33 - #define DMOV_SD_AARM DMOV_SD2 34 - #else 35 - #define DMOV_SD_AARM DMOV_SD3 36 - #endif 37 - 38 - #define DMOV_CMD_PTR(ch) DMOV_SD_AARM(0x000, ch) 39 - #define DMOV_RSLT(ch) DMOV_SD_AARM(0x040, ch) 40 - #define DMOV_FLUSH0(ch) DMOV_SD_AARM(0x080, ch) 41 - #define DMOV_FLUSH1(ch) DMOV_SD_AARM(0x0C0, ch) 42 - #define DMOV_FLUSH2(ch) DMOV_SD_AARM(0x100, ch) 43 - #define DMOV_FLUSH3(ch) DMOV_SD_AARM(0x140, ch) 44 - #define DMOV_FLUSH4(ch) DMOV_SD_AARM(0x180, ch) 45 - #define DMOV_FLUSH5(ch) DMOV_SD_AARM(0x1C0, ch) 46 - 47 - #define DMOV_STATUS(ch) DMOV_SD_AARM(0x200, ch) 48 - #define DMOV_ISR DMOV_SD_AARM(0x380, 0) 49 - 50 - #define DMOV_CONFIG(ch) DMOV_SD_AARM(0x300, ch) 51 - 52 - enum { 53 - MSM_DMOV_PRINT_ERRORS = 1, 54 - MSM_DMOV_PRINT_IO = 2, 55 - MSM_DMOV_PRINT_FLOW = 4 56 - }; 57 - 58 - static DEFINE_SPINLOCK(msm_dmov_lock); 59 - static struct clk *msm_dmov_clk; 60 - static unsigned int channel_active; 61 - static struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT]; 62 - static struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT]; 63 - unsigned int msm_dmov_print_mask = MSM_DMOV_PRINT_ERRORS; 64 - 65 - #define MSM_DMOV_DPRINTF(mask, format, args...) \ 66 - do { \ 67 - if ((mask) & msm_dmov_print_mask) \ 68 - printk(KERN_ERR format, args); \ 69 - } while (0) 70 - #define PRINT_ERROR(format, args...) \ 71 - MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_ERRORS, format, args); 72 - #define PRINT_IO(format, args...) \ 73 - MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_IO, format, args); 74 - #define PRINT_FLOW(format, args...) \ 75 - MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_FLOW, format, args); 76 - 77 - void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful) 78 - { 79 - writel((graceful << 31), DMOV_FLUSH0(id)); 80 - } 81 - EXPORT_SYMBOL_GPL(msm_dmov_stop_cmd); 82 - 83 - void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd) 84 - { 85 - unsigned long irq_flags; 86 - unsigned int status; 87 - 88 - spin_lock_irqsave(&msm_dmov_lock, irq_flags); 89 - if (!channel_active) 90 - clk_enable(msm_dmov_clk); 91 - dsb(); 92 - status = readl(DMOV_STATUS(id)); 93 - if (list_empty(&ready_commands[id]) && 94 - (status & DMOV_STATUS_CMD_PTR_RDY)) { 95 - #if 0 96 - if (list_empty(&active_commands[id])) { 97 - PRINT_FLOW("msm_dmov_enqueue_cmd(%d), enable interrupt\n", id); 98 - writel(DMOV_CONFIG_IRQ_EN, DMOV_CONFIG(id)); 99 - } 100 - #endif 101 - if (cmd->execute_func) 102 - cmd->execute_func(cmd); 103 - PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n", id, status); 104 - list_add_tail(&cmd->list, &active_commands[id]); 105 - if (!channel_active) 106 - enable_irq(INT_ADM_AARM); 107 - channel_active |= 1U << id; 108 - writel(cmd->cmdptr, DMOV_CMD_PTR(id)); 109 - } else { 110 - if (!channel_active) 111 - clk_disable(msm_dmov_clk); 112 - if (list_empty(&active_commands[id])) 113 - PRINT_ERROR("msm_dmov_enqueue_cmd(%d), error datamover stalled, status %x\n", id, status); 114 - 115 - PRINT_IO("msm_dmov_enqueue_cmd(%d), enqueue command, status %x\n", id, status); 116 - list_add_tail(&cmd->list, &ready_commands[id]); 117 - } 118 - spin_unlock_irqrestore(&msm_dmov_lock, irq_flags); 119 - } 120 - EXPORT_SYMBOL_GPL(msm_dmov_enqueue_cmd); 121 - 122 - struct msm_dmov_exec_cmdptr_cmd { 123 - struct msm_dmov_cmd dmov_cmd; 124 - struct completion complete; 125 - unsigned id; 126 - unsigned int result; 127 - struct msm_dmov_errdata err; 128 - }; 129 - 130 - static void 131 - dmov_exec_cmdptr_complete_func(struct msm_dmov_cmd *_cmd, 132 - unsigned int result, 133 - struct msm_dmov_errdata *err) 134 - { 135 - struct msm_dmov_exec_cmdptr_cmd *cmd = container_of(_cmd, struct msm_dmov_exec_cmdptr_cmd, dmov_cmd); 136 - cmd->result = result; 137 - if (result != 0x80000002 && err) 138 - memcpy(&cmd->err, err, sizeof(struct msm_dmov_errdata)); 139 - 140 - complete(&cmd->complete); 141 - } 142 - 143 - int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr) 144 - { 145 - struct msm_dmov_exec_cmdptr_cmd cmd; 146 - 147 - PRINT_FLOW("dmov_exec_cmdptr(%d, %x)\n", id, cmdptr); 148 - 149 - cmd.dmov_cmd.cmdptr = cmdptr; 150 - cmd.dmov_cmd.complete_func = dmov_exec_cmdptr_complete_func; 151 - cmd.dmov_cmd.execute_func = NULL; 152 - cmd.id = id; 153 - init_completion(&cmd.complete); 154 - 155 - msm_dmov_enqueue_cmd(id, &cmd.dmov_cmd); 156 - wait_for_completion(&cmd.complete); 157 - 158 - if (cmd.result != 0x80000002) { 159 - PRINT_ERROR("dmov_exec_cmdptr(%d): ERROR, result: %x\n", id, cmd.result); 160 - PRINT_ERROR("dmov_exec_cmdptr(%d): flush: %x %x %x %x\n", 161 - id, cmd.err.flush[0], cmd.err.flush[1], cmd.err.flush[2], cmd.err.flush[3]); 162 - return -EIO; 163 - } 164 - PRINT_FLOW("dmov_exec_cmdptr(%d, %x) done\n", id, cmdptr); 165 - return 0; 166 - } 167 - 168 - 169 - static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id) 170 - { 171 - unsigned int int_status, mask, id; 172 - unsigned long irq_flags; 173 - unsigned int ch_status; 174 - unsigned int ch_result; 175 - struct msm_dmov_cmd *cmd; 176 - 177 - spin_lock_irqsave(&msm_dmov_lock, irq_flags); 178 - 179 - int_status = readl(DMOV_ISR); /* read and clear interrupt */ 180 - PRINT_FLOW("msm_datamover_irq_handler: DMOV_ISR %x\n", int_status); 181 - 182 - while (int_status) { 183 - mask = int_status & -int_status; 184 - id = fls(mask) - 1; 185 - PRINT_FLOW("msm_datamover_irq_handler %08x %08x id %d\n", int_status, mask, id); 186 - int_status &= ~mask; 187 - ch_status = readl(DMOV_STATUS(id)); 188 - if (!(ch_status & DMOV_STATUS_RSLT_VALID)) { 189 - PRINT_FLOW("msm_datamover_irq_handler id %d, result not valid %x\n", id, ch_status); 190 - continue; 191 - } 192 - do { 193 - ch_result = readl(DMOV_RSLT(id)); 194 - if (list_empty(&active_commands[id])) { 195 - PRINT_ERROR("msm_datamover_irq_handler id %d, got result " 196 - "with no active command, status %x, result %x\n", 197 - id, ch_status, ch_result); 198 - cmd = NULL; 199 - } else 200 - cmd = list_entry(active_commands[id].next, typeof(*cmd), list); 201 - PRINT_FLOW("msm_datamover_irq_handler id %d, status %x, result %x\n", id, ch_status, ch_result); 202 - if (ch_result & DMOV_RSLT_DONE) { 203 - PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", 204 - id, ch_status); 205 - PRINT_IO("msm_datamover_irq_handler id %d, got result " 206 - "for %p, result %x\n", id, cmd, ch_result); 207 - if (cmd) { 208 - list_del(&cmd->list); 209 - dsb(); 210 - cmd->complete_func(cmd, ch_result, NULL); 211 - } 212 - } 213 - if (ch_result & DMOV_RSLT_FLUSH) { 214 - struct msm_dmov_errdata errdata; 215 - 216 - errdata.flush[0] = readl(DMOV_FLUSH0(id)); 217 - errdata.flush[1] = readl(DMOV_FLUSH1(id)); 218 - errdata.flush[2] = readl(DMOV_FLUSH2(id)); 219 - errdata.flush[3] = readl(DMOV_FLUSH3(id)); 220 - errdata.flush[4] = readl(DMOV_FLUSH4(id)); 221 - errdata.flush[5] = readl(DMOV_FLUSH5(id)); 222 - PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status); 223 - PRINT_FLOW("msm_datamover_irq_handler id %d, flush, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]); 224 - if (cmd) { 225 - list_del(&cmd->list); 226 - dsb(); 227 - cmd->complete_func(cmd, ch_result, &errdata); 228 - } 229 - } 230 - if (ch_result & DMOV_RSLT_ERROR) { 231 - struct msm_dmov_errdata errdata; 232 - 233 - errdata.flush[0] = readl(DMOV_FLUSH0(id)); 234 - errdata.flush[1] = readl(DMOV_FLUSH1(id)); 235 - errdata.flush[2] = readl(DMOV_FLUSH2(id)); 236 - errdata.flush[3] = readl(DMOV_FLUSH3(id)); 237 - errdata.flush[4] = readl(DMOV_FLUSH4(id)); 238 - errdata.flush[5] = readl(DMOV_FLUSH5(id)); 239 - 240 - PRINT_ERROR("msm_datamover_irq_handler id %d, status %x\n", id, ch_status); 241 - PRINT_ERROR("msm_datamover_irq_handler id %d, error, result %x, flush0 %x\n", id, ch_result, errdata.flush[0]); 242 - if (cmd) { 243 - list_del(&cmd->list); 244 - dsb(); 245 - cmd->complete_func(cmd, ch_result, &errdata); 246 - } 247 - /* this does not seem to work, once we get an error */ 248 - /* the datamover will no longer accept commands */ 249 - writel(0, DMOV_FLUSH0(id)); 250 - } 251 - ch_status = readl(DMOV_STATUS(id)); 252 - PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status); 253 - if ((ch_status & DMOV_STATUS_CMD_PTR_RDY) && !list_empty(&ready_commands[id])) { 254 - cmd = list_entry(ready_commands[id].next, typeof(*cmd), list); 255 - list_move_tail(&cmd->list, &active_commands[id]); 256 - if (cmd->execute_func) 257 - cmd->execute_func(cmd); 258 - PRINT_FLOW("msm_datamover_irq_handler id %d, start command\n", id); 259 - writel(cmd->cmdptr, DMOV_CMD_PTR(id)); 260 - } 261 - } while (ch_status & DMOV_STATUS_RSLT_VALID); 262 - if (list_empty(&active_commands[id]) && list_empty(&ready_commands[id])) 263 - channel_active &= ~(1U << id); 264 - PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status); 265 - } 266 - 267 - if (!channel_active) { 268 - disable_irq_nosync(INT_ADM_AARM); 269 - clk_disable(msm_dmov_clk); 270 - } 271 - 272 - spin_unlock_irqrestore(&msm_dmov_lock, irq_flags); 273 - return IRQ_HANDLED; 274 - } 275 - 276 - static int __init msm_init_datamover(void) 277 - { 278 - int i; 279 - int ret; 280 - struct clk *clk; 281 - 282 - for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) { 283 - INIT_LIST_HEAD(&ready_commands[i]); 284 - INIT_LIST_HEAD(&active_commands[i]); 285 - writel(DMOV_CONFIG_IRQ_EN | DMOV_CONFIG_FORCE_TOP_PTR_RSLT | DMOV_CONFIG_FORCE_FLUSH_RSLT, DMOV_CONFIG(i)); 286 - } 287 - clk = clk_get(NULL, "adm_clk"); 288 - if (IS_ERR(clk)) 289 - return PTR_ERR(clk); 290 - clk_prepare(clk); 291 - msm_dmov_clk = clk; 292 - ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL); 293 - if (ret) 294 - return ret; 295 - disable_irq(INT_ADM_AARM); 296 - return 0; 297 - } 298 - module_init(msm_init_datamover);
-51
arch/arm/mach-msm/gpiomux-8x50.c
··· 1 - /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 - * 02110-1301, USA. 16 - */ 17 - #include "gpiomux.h" 18 - 19 - #if defined(CONFIG_MMC_MSM) || defined(CONFIG_MMC_MSM_MODULE) 20 - #define SDCC_DAT_0_3_CMD_ACTV_CFG (GPIOMUX_VALID | GPIOMUX_PULL_UP\ 21 - | GPIOMUX_FUNC_1 | GPIOMUX_DRV_8MA) 22 - #define SDCC_CLK_ACTV_CFG (GPIOMUX_VALID | GPIOMUX_PULL_NONE\ 23 - | GPIOMUX_FUNC_1 | GPIOMUX_DRV_8MA) 24 - #else 25 - #define SDCC_DAT_0_3_CMD_ACTV_CFG 0 26 - #define SDCC_CLK_ACTV_CFG 0 27 - #endif 28 - 29 - #define SDC1_SUSPEND_CONFIG (GPIOMUX_VALID | GPIOMUX_PULL_DOWN\ 30 - | GPIOMUX_FUNC_GPIO | GPIOMUX_DRV_2MA) 31 - 32 - struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = { 33 - [86] = { /* UART3 RX */ 34 - .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN | 35 - GPIOMUX_FUNC_1 | GPIOMUX_VALID, 36 - }, 37 - [87] = { /* UART3 TX */ 38 - .suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN | 39 - GPIOMUX_FUNC_1 | GPIOMUX_VALID, 40 - }, 41 - /* SDC1 data[3:0] & CMD */ 42 - [51 ... 55] = { 43 - .active = SDCC_DAT_0_3_CMD_ACTV_CFG, 44 - .suspended = SDC1_SUSPEND_CONFIG 45 - }, 46 - /* SDC1 CLK */ 47 - [56] = { 48 - .active = SDCC_CLK_ACTV_CFG, 49 - .suspended = SDC1_SUSPEND_CONFIG 50 - }, 51 - };
-67
arch/arm/mach-msm/gpiomux-v1.h
··· 1 - /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 - * 02110-1301, USA. 16 - */ 17 - #ifndef __ARCH_ARM_MACH_MSM_GPIOMUX_V1_H 18 - #define __ARCH_ARM_MACH_MSM_GPIOMUX_V1_H 19 - 20 - #if defined(CONFIG_ARCH_MSM7X30) 21 - #define GPIOMUX_NGPIOS 182 22 - #elif defined(CONFIG_ARCH_QSD8X50) 23 - #define GPIOMUX_NGPIOS 165 24 - #else 25 - #define GPIOMUX_NGPIOS 133 26 - #endif 27 - 28 - typedef u32 gpiomux_config_t; 29 - 30 - enum { 31 - GPIOMUX_DRV_2MA = 0UL << 17, 32 - GPIOMUX_DRV_4MA = 1UL << 17, 33 - GPIOMUX_DRV_6MA = 2UL << 17, 34 - GPIOMUX_DRV_8MA = 3UL << 17, 35 - GPIOMUX_DRV_10MA = 4UL << 17, 36 - GPIOMUX_DRV_12MA = 5UL << 17, 37 - GPIOMUX_DRV_14MA = 6UL << 17, 38 - GPIOMUX_DRV_16MA = 7UL << 17, 39 - }; 40 - 41 - enum { 42 - GPIOMUX_FUNC_GPIO = 0UL, 43 - GPIOMUX_FUNC_1 = 1UL, 44 - GPIOMUX_FUNC_2 = 2UL, 45 - GPIOMUX_FUNC_3 = 3UL, 46 - GPIOMUX_FUNC_4 = 4UL, 47 - GPIOMUX_FUNC_5 = 5UL, 48 - GPIOMUX_FUNC_6 = 6UL, 49 - GPIOMUX_FUNC_7 = 7UL, 50 - GPIOMUX_FUNC_8 = 8UL, 51 - GPIOMUX_FUNC_9 = 9UL, 52 - GPIOMUX_FUNC_A = 10UL, 53 - GPIOMUX_FUNC_B = 11UL, 54 - GPIOMUX_FUNC_C = 12UL, 55 - GPIOMUX_FUNC_D = 13UL, 56 - GPIOMUX_FUNC_E = 14UL, 57 - GPIOMUX_FUNC_F = 15UL, 58 - }; 59 - 60 - enum { 61 - GPIOMUX_PULL_NONE = 0UL << 15, 62 - GPIOMUX_PULL_DOWN = 1UL << 15, 63 - GPIOMUX_PULL_KEEPER = 2UL << 15, 64 - GPIOMUX_PULL_UP = 3UL << 15, 65 - }; 66 - 67 - #endif
-111
arch/arm/mach-msm/gpiomux.c
··· 1 - /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 - * 02110-1301, USA. 16 - */ 17 - #include <linux/module.h> 18 - #include <linux/spinlock.h> 19 - #include "gpiomux.h" 20 - #include "proc_comm.h" 21 - 22 - static DEFINE_SPINLOCK(gpiomux_lock); 23 - 24 - static void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val) 25 - { 26 - unsigned tlmm_config = (val & ~GPIOMUX_CTL_MASK) | 27 - ((gpio & 0x3ff) << 4); 28 - unsigned tlmm_disable = 0; 29 - int rc; 30 - 31 - rc = msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, 32 - &tlmm_config, &tlmm_disable); 33 - if (rc) 34 - pr_err("%s: unexpected proc_comm failure %d: %08x %08x\n", 35 - __func__, rc, tlmm_config, tlmm_disable); 36 - } 37 - 38 - int msm_gpiomux_write(unsigned gpio, 39 - gpiomux_config_t active, 40 - gpiomux_config_t suspended) 41 - { 42 - struct msm_gpiomux_config *cfg = msm_gpiomux_configs + gpio; 43 - unsigned long irq_flags; 44 - gpiomux_config_t setting; 45 - 46 - if (gpio >= GPIOMUX_NGPIOS) 47 - return -EINVAL; 48 - 49 - spin_lock_irqsave(&gpiomux_lock, irq_flags); 50 - 51 - if (active & GPIOMUX_VALID) 52 - cfg->active = active; 53 - 54 - if (suspended & GPIOMUX_VALID) 55 - cfg->suspended = suspended; 56 - 57 - setting = cfg->ref ? active : suspended; 58 - if (setting & GPIOMUX_VALID) 59 - __msm_gpiomux_write(gpio, setting); 60 - 61 - spin_unlock_irqrestore(&gpiomux_lock, irq_flags); 62 - return 0; 63 - } 64 - EXPORT_SYMBOL(msm_gpiomux_write); 65 - 66 - int msm_gpiomux_get(unsigned gpio) 67 - { 68 - struct msm_gpiomux_config *cfg = msm_gpiomux_configs + gpio; 69 - unsigned long irq_flags; 70 - 71 - if (gpio >= GPIOMUX_NGPIOS) 72 - return -EINVAL; 73 - 74 - spin_lock_irqsave(&gpiomux_lock, irq_flags); 75 - if (cfg->ref++ == 0 && cfg->active & GPIOMUX_VALID) 76 - __msm_gpiomux_write(gpio, cfg->active); 77 - spin_unlock_irqrestore(&gpiomux_lock, irq_flags); 78 - return 0; 79 - } 80 - EXPORT_SYMBOL(msm_gpiomux_get); 81 - 82 - int msm_gpiomux_put(unsigned gpio) 83 - { 84 - struct msm_gpiomux_config *cfg = msm_gpiomux_configs + gpio; 85 - unsigned long irq_flags; 86 - 87 - if (gpio >= GPIOMUX_NGPIOS) 88 - return -EINVAL; 89 - 90 - spin_lock_irqsave(&gpiomux_lock, irq_flags); 91 - BUG_ON(cfg->ref == 0); 92 - if (--cfg->ref == 0 && cfg->suspended & GPIOMUX_VALID) 93 - __msm_gpiomux_write(gpio, cfg->suspended); 94 - spin_unlock_irqrestore(&gpiomux_lock, irq_flags); 95 - return 0; 96 - } 97 - EXPORT_SYMBOL(msm_gpiomux_put); 98 - 99 - static int __init gpiomux_init(void) 100 - { 101 - unsigned n; 102 - 103 - for (n = 0; n < GPIOMUX_NGPIOS; ++n) { 104 - msm_gpiomux_configs[n].ref = 0; 105 - if (!(msm_gpiomux_configs[n].suspended & GPIOMUX_VALID)) 106 - continue; 107 - __msm_gpiomux_write(n, msm_gpiomux_configs[n].suspended); 108 - } 109 - return 0; 110 - } 111 - postcore_initcall(gpiomux_init);
-84
arch/arm/mach-msm/gpiomux.h
··· 1 - /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 - * 02110-1301, USA. 16 - */ 17 - #ifndef __ARCH_ARM_MACH_MSM_GPIOMUX_H 18 - #define __ARCH_ARM_MACH_MSM_GPIOMUX_H 19 - 20 - #include <linux/bitops.h> 21 - #include <linux/errno.h> 22 - #include <mach/msm_gpiomux.h> 23 - #include "gpiomux-v1.h" 24 - 25 - /** 26 - * struct msm_gpiomux_config: gpiomux settings for one gpio line. 27 - * 28 - * A complete gpiomux config is the bitwise-or of a drive-strength, 29 - * function, and pull. For functions other than GPIO, the OE 30 - * is hard-wired according to the function. For GPIO mode, 31 - * OE is controlled by gpiolib. 32 - * 33 - * Available settings differ by target; see the gpiomux header 34 - * specific to your target arch for available configurations. 35 - * 36 - * @active: The configuration to be installed when the line is 37 - * active, or its reference count is > 0. 38 - * @suspended: The configuration to be installed when the line 39 - * is suspended, or its reference count is 0. 40 - * @ref: The reference count of the line. For internal use of 41 - * the gpiomux framework only. 42 - */ 43 - struct msm_gpiomux_config { 44 - gpiomux_config_t active; 45 - gpiomux_config_t suspended; 46 - unsigned ref; 47 - }; 48 - 49 - /** 50 - * @GPIOMUX_VALID: If set, the config field contains 'good data'. 51 - * The absence of this bit will prevent the gpiomux 52 - * system from applying the configuration under all 53 - * circumstances. 54 - */ 55 - enum { 56 - GPIOMUX_VALID = BIT(sizeof(gpiomux_config_t) * BITS_PER_BYTE - 1), 57 - GPIOMUX_CTL_MASK = GPIOMUX_VALID, 58 - }; 59 - 60 - #ifdef CONFIG_MSM_GPIOMUX 61 - 62 - /* Each architecture must provide its own instance of this table. 63 - * To avoid having gpiomux manage any given gpio, one or both of 64 - * the entries can avoid setting GPIOMUX_VALID - the absence 65 - * of that flag will prevent the configuration from being applied 66 - * during state transitions. 67 - */ 68 - extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS]; 69 - 70 - /* Install a new configuration to the gpio line. To avoid overwriting 71 - * a configuration, leave the VALID bit out. 72 - */ 73 - int msm_gpiomux_write(unsigned gpio, 74 - gpiomux_config_t active, 75 - gpiomux_config_t suspended); 76 - #else 77 - static inline int msm_gpiomux_write(unsigned gpio, 78 - gpiomux_config_t active, 79 - gpiomux_config_t suspended) 80 - { 81 - return -ENOSYS; 82 - } 83 - #endif 84 - #endif
-31
arch/arm/mach-msm/include/mach/clk.h
··· 1 - /* Copyright (c) 2009, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - */ 12 - #ifndef __MACH_CLK_H 13 - #define __MACH_CLK_H 14 - 15 - /* Magic rate value for use with PM QOS to request the board's maximum 16 - * supported AXI rate. PM QOS will only pass positive s32 rate values 17 - * through to the clock driver, so INT_MAX is used. 18 - */ 19 - #define MSM_AXI_MAX_FREQ LONG_MAX 20 - 21 - enum clk_reset_action { 22 - CLK_RESET_DEASSERT = 0, 23 - CLK_RESET_ASSERT = 1 24 - }; 25 - 26 - struct clk; 27 - 28 - /* Assert/Deassert reset to a hardware block associated with a clock */ 29 - int clk_reset(struct clk *clk, enum clk_reset_action action); 30 - 31 - #endif
-151
arch/arm/mach-msm/include/mach/dma.h
··· 1 - /* linux/include/asm-arm/arch-msm/dma.h 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #ifndef __ASM_ARCH_MSM_DMA_H 17 - 18 - #include <linux/list.h> 19 - 20 - struct msm_dmov_errdata { 21 - uint32_t flush[6]; 22 - }; 23 - 24 - struct msm_dmov_cmd { 25 - struct list_head list; 26 - unsigned int cmdptr; 27 - void (*complete_func)(struct msm_dmov_cmd *cmd, 28 - unsigned int result, 29 - struct msm_dmov_errdata *err); 30 - void (*execute_func)(struct msm_dmov_cmd *cmd); 31 - void *data; 32 - }; 33 - 34 - #ifndef CONFIG_ARCH_MSM8X60 35 - void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd); 36 - void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful); 37 - int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr); 38 - #else 39 - static inline 40 - void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd) { } 41 - static inline 42 - void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful) { } 43 - static inline 44 - int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr) { return -EIO; } 45 - #endif 46 - 47 - #define DMOV_CMD_LIST (0 << 29) /* does not work */ 48 - #define DMOV_CMD_PTR_LIST (1 << 29) /* works */ 49 - #define DMOV_CMD_INPUT_CFG (2 << 29) /* untested */ 50 - #define DMOV_CMD_OUTPUT_CFG (3 << 29) /* untested */ 51 - #define DMOV_CMD_ADDR(addr) ((addr) >> 3) 52 - 53 - #define DMOV_RSLT_VALID (1 << 31) /* 0 == host has empties result fifo */ 54 - #define DMOV_RSLT_ERROR (1 << 3) 55 - #define DMOV_RSLT_FLUSH (1 << 2) 56 - #define DMOV_RSLT_DONE (1 << 1) /* top pointer done */ 57 - #define DMOV_RSLT_USER (1 << 0) /* command with FR force result */ 58 - 59 - #define DMOV_STATUS_RSLT_COUNT(n) (((n) >> 29)) 60 - #define DMOV_STATUS_CMD_COUNT(n) (((n) >> 27) & 3) 61 - #define DMOV_STATUS_RSLT_VALID (1 << 1) 62 - #define DMOV_STATUS_CMD_PTR_RDY (1 << 0) 63 - 64 - #define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2) 65 - #define DMOV_CONFIG_FORCE_FLUSH_RSLT (1 << 1) 66 - #define DMOV_CONFIG_IRQ_EN (1 << 0) 67 - 68 - /* channel assignments */ 69 - 70 - #define DMOV_NAND_CHAN 7 71 - #define DMOV_NAND_CRCI_CMD 5 72 - #define DMOV_NAND_CRCI_DATA 4 73 - 74 - #define DMOV_SDC1_CHAN 8 75 - #define DMOV_SDC1_CRCI 6 76 - 77 - #define DMOV_SDC2_CHAN 8 78 - #define DMOV_SDC2_CRCI 7 79 - 80 - #define DMOV_TSIF_CHAN 10 81 - #define DMOV_TSIF_CRCI 10 82 - 83 - #define DMOV_USB_CHAN 11 84 - 85 - /* no client rate control ifc (eg, ram) */ 86 - #define DMOV_NONE_CRCI 0 87 - 88 - 89 - /* If the CMD_PTR register has CMD_PTR_LIST selected, the data mover 90 - * is going to walk a list of 32bit pointers as described below. Each 91 - * pointer points to a *array* of dmov_s, etc structs. The last pointer 92 - * in the list is marked with CMD_PTR_LP. The last struct in each array 93 - * is marked with CMD_LC (see below). 94 - */ 95 - #define CMD_PTR_ADDR(addr) ((addr) >> 3) 96 - #define CMD_PTR_LP (1 << 31) /* last pointer */ 97 - #define CMD_PTR_PT (3 << 29) /* ? */ 98 - 99 - /* Single Item Mode */ 100 - typedef struct { 101 - unsigned cmd; 102 - unsigned src; 103 - unsigned dst; 104 - unsigned len; 105 - } dmov_s; 106 - 107 - /* Scatter/Gather Mode */ 108 - typedef struct { 109 - unsigned cmd; 110 - unsigned src_dscr; 111 - unsigned dst_dscr; 112 - unsigned _reserved; 113 - } dmov_sg; 114 - 115 - /* Box mode */ 116 - typedef struct { 117 - uint32_t cmd; 118 - uint32_t src_row_addr; 119 - uint32_t dst_row_addr; 120 - uint32_t src_dst_len; 121 - uint32_t num_rows; 122 - uint32_t row_offset; 123 - } dmov_box; 124 - 125 - /* bits for the cmd field of the above structures */ 126 - 127 - #define CMD_LC (1 << 31) /* last command */ 128 - #define CMD_FR (1 << 22) /* force result -- does not work? */ 129 - #define CMD_OCU (1 << 21) /* other channel unblock */ 130 - #define CMD_OCB (1 << 20) /* other channel block */ 131 - #define CMD_TCB (1 << 19) /* ? */ 132 - #define CMD_DAH (1 << 18) /* destination address hold -- does not work?*/ 133 - #define CMD_SAH (1 << 17) /* source address hold -- does not work? */ 134 - 135 - #define CMD_MODE_SINGLE (0 << 0) /* dmov_s structure used */ 136 - #define CMD_MODE_SG (1 << 0) /* untested */ 137 - #define CMD_MODE_IND_SG (2 << 0) /* untested */ 138 - #define CMD_MODE_BOX (3 << 0) /* untested */ 139 - 140 - #define CMD_DST_SWAP_BYTES (1 << 14) /* exchange each byte n with byte n+1 */ 141 - #define CMD_DST_SWAP_SHORTS (1 << 15) /* exchange each short n with short n+1 */ 142 - #define CMD_DST_SWAP_WORDS (1 << 16) /* exchange each word n with word n+1 */ 143 - 144 - #define CMD_SRC_SWAP_BYTES (1 << 11) /* exchange each byte n with byte n+1 */ 145 - #define CMD_SRC_SWAP_SHORTS (1 << 12) /* exchange each short n with short n+1 */ 146 - #define CMD_SRC_SWAP_WORDS (1 << 13) /* exchange each word n with word n+1 */ 147 - 148 - #define CMD_DST_CRCI(n) (((n) & 15) << 7) 149 - #define CMD_SRC_CRCI(n) (((n) & 15) << 3) 150 - 151 - #endif
-36
arch/arm/mach-msm/include/mach/entry-macro.S
··· 1 - /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 - * 02110-1301, USA. 16 - * 17 - */ 18 - 19 - #if !defined(CONFIG_ARM_GIC) 20 - #include <mach/msm_iomap.h> 21 - 22 - .macro get_irqnr_preamble, base, tmp 23 - @ enable imprecise aborts 24 - cpsie a 25 - mov \base, #MSM_VIC_BASE 26 - .endm 27 - 28 - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 29 - @ 0xD0 has irq# or old irq# if the irq has been handled 30 - @ 0xD4 has irq# or -1 if none pending *but* if you just 31 - @ read 0xD4 you never get the first irq for some reason 32 - ldr \irqnr, [\base, #0xD0] 33 - ldr \irqnr, [\base, #0xD4] 34 - cmp \irqnr, #0xffffffff 35 - .endm 36 - #endif
-18
arch/arm/mach-msm/include/mach/hardware.h
··· 1 - /* arch/arm/mach-msm/include/mach/hardware.h 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #ifndef __ASM_ARCH_MSM_HARDWARE_H 17 - 18 - #endif
-75
arch/arm/mach-msm/include/mach/irqs-7x00.h
··· 1 - /* 2 - * Copyright (C) 2007 Google, Inc. 3 - * Copyright (c) 2009, Code Aurora Forum. All rights reserved. 4 - * Author: Brian Swetland <swetland@google.com> 5 - */ 6 - 7 - #ifndef __ASM_ARCH_MSM_IRQS_7X00_H 8 - #define __ASM_ARCH_MSM_IRQS_7X00_H 9 - 10 - /* MSM ARM11 Interrupt Numbers */ 11 - /* See 80-VE113-1 A, pp219-221 */ 12 - 13 - #define INT_A9_M2A_0 0 14 - #define INT_A9_M2A_1 1 15 - #define INT_A9_M2A_2 2 16 - #define INT_A9_M2A_3 3 17 - #define INT_A9_M2A_4 4 18 - #define INT_A9_M2A_5 5 19 - #define INT_A9_M2A_6 6 20 - #define INT_GP_TIMER_EXP 7 21 - #define INT_DEBUG_TIMER_EXP 8 22 - #define INT_UART1 9 23 - #define INT_UART2 10 24 - #define INT_UART3 11 25 - #define INT_UART1_RX 12 26 - #define INT_UART2_RX 13 27 - #define INT_UART3_RX 14 28 - #define INT_USB_OTG 15 29 - #define INT_MDDI_PRI 16 30 - #define INT_MDDI_EXT 17 31 - #define INT_MDDI_CLIENT 18 32 - #define INT_MDP 19 33 - #define INT_GRAPHICS 20 34 - #define INT_ADM_AARM 21 35 - #define INT_ADSP_A11 22 36 - #define INT_ADSP_A9_A11 23 37 - #define INT_SDC1_0 24 38 - #define INT_SDC1_1 25 39 - #define INT_SDC2_0 26 40 - #define INT_SDC2_1 27 41 - #define INT_KEYSENSE 28 42 - #define INT_TCHSCRN_SSBI 29 43 - #define INT_TCHSCRN1 30 44 - #define INT_TCHSCRN2 31 45 - 46 - #define INT_GPIO_GROUP1 (32 + 0) 47 - #define INT_GPIO_GROUP2 (32 + 1) 48 - #define INT_PWB_I2C (32 + 2) 49 - #define INT_SOFTRESET (32 + 3) 50 - #define INT_NAND_WR_ER_DONE (32 + 4) 51 - #define INT_NAND_OP_DONE (32 + 5) 52 - #define INT_PBUS_ARM11 (32 + 6) 53 - #define INT_AXI_MPU_SMI (32 + 7) 54 - #define INT_AXI_MPU_EBI1 (32 + 8) 55 - #define INT_AD_HSSD (32 + 9) 56 - #define INT_ARM11_PMU (32 + 10) 57 - #define INT_ARM11_DMA (32 + 11) 58 - #define INT_TSIF_IRQ (32 + 12) 59 - #define INT_UART1DM_IRQ (32 + 13) 60 - #define INT_UART1DM_RX (32 + 14) 61 - #define INT_USB_HS (32 + 15) 62 - #define INT_SDC3_0 (32 + 16) 63 - #define INT_SDC3_1 (32 + 17) 64 - #define INT_SDC4_0 (32 + 18) 65 - #define INT_SDC4_1 (32 + 19) 66 - #define INT_UART2DM_RX (32 + 20) 67 - #define INT_UART2DM_IRQ (32 + 21) 68 - 69 - /* 22-31 are reserved */ 70 - 71 - #define NR_MSM_IRQS 64 72 - #define NR_GPIO_IRQS 122 73 - #define NR_BOARD_IRQS 64 74 - 75 - #endif
-153
arch/arm/mach-msm/include/mach/irqs-7x30.h
··· 1 - /* Copyright (c) 2009, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - */ 12 - 13 - #ifndef __ASM_ARCH_MSM_IRQS_7X30_H 14 - #define __ASM_ARCH_MSM_IRQS_7X30_H 15 - 16 - /* MSM ACPU Interrupt Numbers */ 17 - 18 - #define INT_DEBUG_TIMER_EXP 0 19 - #define INT_GPT0_TIMER_EXP 1 20 - #define INT_GPT1_TIMER_EXP 2 21 - #define INT_WDT0_ACCSCSSBARK 3 22 - #define INT_WDT1_ACCSCSSBARK 4 23 - #define INT_AVS_SVIC 5 24 - #define INT_AVS_SVIC_SW_DONE 6 25 - #define INT_SC_DBG_RX_FULL 7 26 - #define INT_SC_DBG_TX_EMPTY 8 27 - #define INT_ARM11_PM 9 28 - #define INT_AVS_REQ_DOWN 10 29 - #define INT_AVS_REQ_UP 11 30 - #define INT_SC_ACG 12 31 - /* SCSS_VICFIQSTS0[13:15] are RESERVED */ 32 - #define INT_L2_SVICCPUIRPTREQ 16 33 - #define INT_L2_SVICDMANSIRPTREQ 17 34 - #define INT_L2_SVICDMASIRPTREQ 18 35 - #define INT_L2_SVICSLVIRPTREQ 19 36 - #define INT_AD5A_MPROC_APPS_0 20 37 - #define INT_AD5A_MPROC_APPS_1 21 38 - #define INT_A9_M2A_0 22 39 - #define INT_A9_M2A_1 23 40 - #define INT_A9_M2A_2 24 41 - #define INT_A9_M2A_3 25 42 - #define INT_A9_M2A_4 26 43 - #define INT_A9_M2A_5 27 44 - #define INT_A9_M2A_6 28 45 - #define INT_A9_M2A_7 29 46 - #define INT_A9_M2A_8 30 47 - #define INT_A9_M2A_9 31 48 - 49 - #define INT_AXI_EBI1_SC (32 + 0) 50 - #define INT_IMEM_ERR (32 + 1) 51 - #define INT_AXI_EBI0_SC (32 + 2) 52 - #define INT_PBUS_SC_IRQC (32 + 3) 53 - #define INT_PERPH_BUS_BPM (32 + 4) 54 - #define INT_CC_TEMP_SENSE (32 + 5) 55 - #define INT_UXMC_EBI0 (32 + 6) 56 - #define INT_UXMC_EBI1 (32 + 7) 57 - #define INT_EBI2_OP_DONE (32 + 8) 58 - #define INT_EBI2_WR_ER_DONE (32 + 9) 59 - #define INT_TCSR_SPSS_CE (32 + 10) 60 - #define INT_EMDH (32 + 11) 61 - #define INT_PMDH (32 + 12) 62 - #define INT_MDC (32 + 13) 63 - #define INT_MIDI_TO_SUPSS (32 + 14) 64 - #define INT_LPA_2 (32 + 15) 65 - #define INT_GPIO_GROUP1_SECURE (32 + 16) 66 - #define INT_GPIO_GROUP2_SECURE (32 + 17) 67 - #define INT_GPIO_GROUP1 (32 + 18) 68 - #define INT_GPIO_GROUP2 (32 + 19) 69 - #define INT_MPRPH_SOFTRESET (32 + 20) 70 - #define INT_PWB_I2C (32 + 21) 71 - #define INT_PWB_I2C_2 (32 + 22) 72 - #define INT_TSSC_SAMPLE (32 + 23) 73 - #define INT_TSSC_PENUP (32 + 24) 74 - #define INT_TCHSCRN_SSBI (32 + 25) 75 - #define INT_FM_RDS (32 + 26) 76 - #define INT_KEYSENSE (32 + 27) 77 - #define INT_USB_OTG_HS (32 + 28) 78 - #define INT_USB_OTG_HS2 (32 + 29) 79 - #define INT_USB_OTG_HS3 (32 + 30) 80 - #define INT_CSI (32 + 31) 81 - 82 - #define INT_SPI_OUTPUT (64 + 0) 83 - #define INT_SPI_INPUT (64 + 1) 84 - #define INT_SPI_ERROR (64 + 2) 85 - #define INT_UART1 (64 + 3) 86 - #define INT_UART1_RX (64 + 4) 87 - #define INT_UART2 (64 + 5) 88 - #define INT_UART2_RX (64 + 6) 89 - #define INT_UART3 (64 + 7) 90 - #define INT_UART3_RX (64 + 8) 91 - #define INT_UART1DM_IRQ (64 + 9) 92 - #define INT_UART1DM_RX (64 + 10) 93 - #define INT_UART2DM_IRQ (64 + 11) 94 - #define INT_UART2DM_RX (64 + 12) 95 - #define INT_TSIF (64 + 13) 96 - #define INT_ADM_SC1 (64 + 14) 97 - #define INT_ADM_SC2 (64 + 15) 98 - #define INT_MDP (64 + 16) 99 - #define INT_VPE (64 + 17) 100 - #define INT_GRP_2D (64 + 18) 101 - #define INT_GRP_3D (64 + 19) 102 - #define INT_ROTATOR (64 + 20) 103 - #define INT_MFC720 (64 + 21) 104 - #define INT_JPEG (64 + 22) 105 - #define INT_VFE (64 + 23) 106 - #define INT_TV_ENC (64 + 24) 107 - #define INT_PMIC_SSBI (64 + 25) 108 - #define INT_MPM_1 (64 + 26) 109 - #define INT_TCSR_SPSS_SAMPLE (64 + 27) 110 - #define INT_TCSR_SPSS_PENUP (64 + 28) 111 - #define INT_MPM_2 (64 + 29) 112 - #define INT_SDC1_0 (64 + 30) 113 - #define INT_SDC1_1 (64 + 31) 114 - 115 - #define INT_SDC3_0 (96 + 0) 116 - #define INT_SDC3_1 (96 + 1) 117 - #define INT_SDC2_0 (96 + 2) 118 - #define INT_SDC2_1 (96 + 3) 119 - #define INT_SDC4_0 (96 + 4) 120 - #define INT_SDC4_1 (96 + 5) 121 - #define INT_PWB_QUP_IN (96 + 6) 122 - #define INT_PWB_QUP_OUT (96 + 7) 123 - #define INT_PWB_QUP_ERR (96 + 8) 124 - #define INT_SCSS_WDT0_BITE (96 + 9) 125 - /* SCSS_VICFIQSTS3[10:31] are RESERVED */ 126 - 127 - /* Retrofit universal macro names */ 128 - #define INT_ADM_AARM INT_ADM_SC2 129 - #define INT_USB_HS INT_USB_OTG_HS 130 - #define INT_USB_OTG INT_USB_OTG_HS 131 - #define INT_TCHSCRN1 INT_TSSC_SAMPLE 132 - #define INT_TCHSCRN2 INT_TSSC_PENUP 133 - #define INT_GP_TIMER_EXP INT_GPT0_TIMER_EXP 134 - #define INT_ADSP_A11 INT_AD5A_MPROC_APPS_0 135 - #define INT_ADSP_A9_A11 INT_AD5A_MPROC_APPS_1 136 - #define INT_MDDI_EXT INT_EMDH 137 - #define INT_MDDI_PRI INT_PMDH 138 - #define INT_MDDI_CLIENT INT_MDC 139 - #define INT_NAND_WR_ER_DONE INT_EBI2_WR_ER_DONE 140 - #define INT_NAND_OP_DONE INT_EBI2_OP_DONE 141 - 142 - #define NR_MSM_IRQS 128 143 - #define NR_GPIO_IRQS 182 144 - #define PMIC8058_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS) 145 - #define NR_PMIC8058_GPIO_IRQS 40 146 - #define NR_PMIC8058_MPP_IRQS 12 147 - #define NR_PMIC8058_MISC_IRQS 8 148 - #define NR_PMIC8058_IRQS (NR_PMIC8058_GPIO_IRQS +\ 149 - NR_PMIC8058_MPP_IRQS +\ 150 - NR_PMIC8058_MISC_IRQS) 151 - #define NR_BOARD_IRQS NR_PMIC8058_IRQS 152 - 153 - #endif /* __ASM_ARCH_MSM_IRQS_7X30_H */
-88
arch/arm/mach-msm/include/mach/irqs-8x50.h
··· 1 - /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - */ 12 - 13 - #ifndef __ASM_ARCH_MSM_IRQS_8XXX_H 14 - #define __ASM_ARCH_MSM_IRQS_8XXX_H 15 - 16 - /* MSM ACPU Interrupt Numbers */ 17 - 18 - #define INT_A9_M2A_0 0 19 - #define INT_A9_M2A_1 1 20 - #define INT_A9_M2A_2 2 21 - #define INT_A9_M2A_3 3 22 - #define INT_A9_M2A_4 4 23 - #define INT_A9_M2A_5 5 24 - #define INT_A9_M2A_6 6 25 - #define INT_GP_TIMER_EXP 7 26 - #define INT_DEBUG_TIMER_EXP 8 27 - #define INT_SIRC_0 9 28 - #define INT_SDC3_0 10 29 - #define INT_SDC3_1 11 30 - #define INT_SDC4_0 12 31 - #define INT_SDC4_1 13 32 - #define INT_AD6_EXT_VFR 14 33 - #define INT_USB_OTG 15 34 - #define INT_MDDI_PRI 16 35 - #define INT_MDDI_EXT 17 36 - #define INT_MDDI_CLIENT 18 37 - #define INT_MDP 19 38 - #define INT_GRAPHICS 20 39 - #define INT_ADM_AARM 21 40 - #define INT_ADSP_A11 22 41 - #define INT_ADSP_A9_A11 23 42 - #define INT_SDC1_0 24 43 - #define INT_SDC1_1 25 44 - #define INT_SDC2_0 26 45 - #define INT_SDC2_1 27 46 - #define INT_KEYSENSE 28 47 - #define INT_TCHSCRN_SSBI 29 48 - #define INT_TCHSCRN1 30 49 - #define INT_TCHSCRN2 31 50 - 51 - #define INT_TCSR_MPRPH_SC1 (32 + 0) 52 - #define INT_USB_FS2 (32 + 1) 53 - #define INT_PWB_I2C (32 + 2) 54 - #define INT_SOFTRESET (32 + 3) 55 - #define INT_NAND_WR_ER_DONE (32 + 4) 56 - #define INT_NAND_OP_DONE (32 + 5) 57 - #define INT_TCSR_MPRPH_SC2 (32 + 6) 58 - #define INT_OP_PEN (32 + 7) 59 - #define INT_AD_HSSD (32 + 8) 60 - #define INT_ARM11_PM (32 + 9) 61 - #define INT_SDMA_NON_SECURE (32 + 10) 62 - #define INT_TSIF_IRQ (32 + 11) 63 - #define INT_UART1DM_IRQ (32 + 12) 64 - #define INT_UART1DM_RX (32 + 13) 65 - #define INT_SDMA_SECURE (32 + 14) 66 - #define INT_SI2S_SLAVE (32 + 15) 67 - #define INT_SC_I2CPU (32 + 16) 68 - #define INT_SC_DBG_RDTRFULL (32 + 17) 69 - #define INT_SC_DBG_WDTRFULL (32 + 18) 70 - #define INT_SCPLL_CTL_DONE (32 + 19) 71 - #define INT_UART2DM_IRQ (32 + 20) 72 - #define INT_UART2DM_RX (32 + 21) 73 - #define INT_VDC_MEC (32 + 22) 74 - #define INT_VDC_DB (32 + 23) 75 - #define INT_VDC_AXI (32 + 24) 76 - #define INT_VFE (32 + 25) 77 - #define INT_USB_HS (32 + 26) 78 - #define INT_AUDIO_OUT0 (32 + 27) 79 - #define INT_AUDIO_OUT1 (32 + 28) 80 - #define INT_CRYPTO (32 + 29) 81 - #define INT_AD6M_IDLE (32 + 30) 82 - #define INT_SIRC_1 (32 + 31) 83 - 84 - #define NR_GPIO_IRQS 165 85 - #define NR_MSM_IRQS 64 86 - #define NR_BOARD_IRQS 64 87 - 88 - #endif
-37
arch/arm/mach-msm/include/mach/irqs.h
··· 1 - /* 2 - * Copyright (C) 2007 Google, Inc. 3 - * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - 17 - #ifndef __ASM_ARCH_MSM_IRQS_H 18 - #define __ASM_ARCH_MSM_IRQS_H 19 - 20 - #define MSM_IRQ_BIT(irq) (1 << ((irq) & 31)) 21 - 22 - #if defined(CONFIG_ARCH_MSM7X30) 23 - #include "irqs-7x30.h" 24 - #elif defined(CONFIG_ARCH_QSD8X50) 25 - #include "irqs-8x50.h" 26 - #include "sirc.h" 27 - #elif defined(CONFIG_ARCH_MSM_ARM11) 28 - #include "irqs-7x00.h" 29 - #else 30 - #error "Unknown architecture specification" 31 - #endif 32 - 33 - #define NR_IRQS (NR_MSM_IRQS + NR_GPIO_IRQS + NR_BOARD_IRQS) 34 - #define MSM_GPIO_TO_INT(n) (NR_MSM_IRQS + (n)) 35 - #define MSM_INT_TO_REG(base, irq) (base + irq / 32) 36 - 37 - #endif
-38
arch/arm/mach-msm/include/mach/msm_gpiomux.h
··· 1 - /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - */ 12 - 13 - #ifndef _LINUX_MSM_GPIOMUX_H 14 - #define _LINUX_MSM_GPIOMUX_H 15 - 16 - #ifdef CONFIG_MSM_GPIOMUX 17 - 18 - /* Increment a gpio's reference count, possibly activating the line. */ 19 - int __must_check msm_gpiomux_get(unsigned gpio); 20 - 21 - /* Decrement a gpio's reference count, possibly suspending the line. */ 22 - int msm_gpiomux_put(unsigned gpio); 23 - 24 - #else 25 - 26 - static inline int __must_check msm_gpiomux_get(unsigned gpio) 27 - { 28 - return -ENOSYS; 29 - } 30 - 31 - static inline int msm_gpiomux_put(unsigned gpio) 32 - { 33 - return -ENOSYS; 34 - } 35 - 36 - #endif 37 - 38 - #endif /* _LINUX_MSM_GPIOMUX_H */
-108
arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
··· 1 - /* arch/arm/mach-msm/include/mach/msm_iomap.h 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 5 - * Author: Brian Swetland <swetland@google.com> 6 - * 7 - * This software is licensed under the terms of the GNU General Public 8 - * License version 2, as published by the Free Software Foundation, and 9 - * may be copied, distributed, and modified under those terms. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * 17 - * The MSM peripherals are spread all over across 768MB of physical 18 - * space, which makes just having a simple IO_ADDRESS macro to slide 19 - * them into the right virtual location rough. Instead, we will 20 - * provide a master phys->virt mapping for peripherals here. 21 - * 22 - */ 23 - 24 - #ifndef __ASM_ARCH_MSM_IOMAP_7X00_H 25 - #define __ASM_ARCH_MSM_IOMAP_7X00_H 26 - 27 - #include <asm/sizes.h> 28 - 29 - /* Physical base address and size of peripherals. 30 - * Ordered by the virtual base addresses they will be mapped at. 31 - * 32 - * MSM_VIC_BASE must be an value that can be loaded via a "mov" 33 - * instruction, otherwise entry-macro.S will not compile. 34 - * 35 - * If you add or remove entries here, you'll want to edit the 36 - * msm_io_desc array in arch/arm/mach-msm/io.c to reflect your 37 - * changes. 38 - * 39 - */ 40 - 41 - #define MSM_VIC_BASE IOMEM(0xE0000000) 42 - #define MSM_VIC_PHYS 0xC0000000 43 - #define MSM_VIC_SIZE SZ_4K 44 - 45 - #define MSM7X00_CSR_PHYS 0xC0100000 46 - #define MSM7X00_CSR_SIZE SZ_4K 47 - 48 - #define MSM_DMOV_BASE IOMEM(0xE0002000) 49 - #define MSM_DMOV_PHYS 0xA9700000 50 - #define MSM_DMOV_SIZE SZ_4K 51 - 52 - #define MSM7X00_GPIO1_PHYS 0xA9200000 53 - #define MSM7X00_GPIO1_SIZE SZ_4K 54 - 55 - #define MSM7X00_GPIO2_PHYS 0xA9300000 56 - #define MSM7X00_GPIO2_SIZE SZ_4K 57 - 58 - #define MSM_CLK_CTL_BASE IOMEM(0xE0005000) 59 - #define MSM_CLK_CTL_PHYS 0xA8600000 60 - #define MSM_CLK_CTL_SIZE SZ_4K 61 - 62 - #define MSM_SHARED_RAM_BASE IOMEM(0xE0100000) 63 - #define MSM_SHARED_RAM_PHYS 0x01F00000 64 - #define MSM_SHARED_RAM_SIZE SZ_1M 65 - 66 - #define MSM_UART1_PHYS 0xA9A00000 67 - #define MSM_UART1_SIZE SZ_4K 68 - 69 - #define MSM_UART2_PHYS 0xA9B00000 70 - #define MSM_UART2_SIZE SZ_4K 71 - 72 - #define MSM_UART3_PHYS 0xA9C00000 73 - #define MSM_UART3_SIZE SZ_4K 74 - 75 - #define MSM_SDC1_PHYS 0xA0400000 76 - #define MSM_SDC1_SIZE SZ_4K 77 - 78 - #define MSM_SDC2_PHYS 0xA0500000 79 - #define MSM_SDC2_SIZE SZ_4K 80 - 81 - #define MSM_SDC3_PHYS 0xA0600000 82 - #define MSM_SDC3_SIZE SZ_4K 83 - 84 - #define MSM_SDC4_PHYS 0xA0700000 85 - #define MSM_SDC4_SIZE SZ_4K 86 - 87 - #define MSM_I2C_PHYS 0xA9900000 88 - #define MSM_I2C_SIZE SZ_4K 89 - 90 - #define MSM_HSUSB_PHYS 0xA0800000 91 - #define MSM_HSUSB_SIZE SZ_4K 92 - 93 - #define MSM_PMDH_PHYS 0xAA600000 94 - #define MSM_PMDH_SIZE SZ_4K 95 - 96 - #define MSM_EMDH_PHYS 0xAA700000 97 - #define MSM_EMDH_SIZE SZ_4K 98 - 99 - #define MSM_MDP_PHYS 0xAA200000 100 - #define MSM_MDP_SIZE 0x000F0000 101 - 102 - #define MSM_MDC_PHYS 0xAA500000 103 - #define MSM_MDC_SIZE SZ_1M 104 - 105 - #define MSM_AD5_PHYS 0xAC000000 106 - #define MSM_AD5_SIZE (SZ_1M*13) 107 - 108 - #endif
-103
arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
··· 1 - /* 2 - * Copyright (C) 2007 Google, Inc. 3 - * Copyright (c) 2008-2011 Code Aurora Forum. All rights reserved. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * 16 - * The MSM peripherals are spread all over across 768MB of physical 17 - * space, which makes just having a simple IO_ADDRESS macro to slide 18 - * them into the right virtual location rough. Instead, we will 19 - * provide a master phys->virt mapping for peripherals here. 20 - * 21 - */ 22 - 23 - #ifndef __ASM_ARCH_MSM_IOMAP_7X30_H 24 - #define __ASM_ARCH_MSM_IOMAP_7X30_H 25 - 26 - /* Physical base address and size of peripherals. 27 - * Ordered by the virtual base addresses they will be mapped at. 28 - * 29 - * MSM_VIC_BASE must be an value that can be loaded via a "mov" 30 - * instruction, otherwise entry-macro.S will not compile. 31 - * 32 - * If you add or remove entries here, you'll want to edit the 33 - * msm_io_desc array in arch/arm/mach-msm/io.c to reflect your 34 - * changes. 35 - * 36 - */ 37 - 38 - #define MSM_VIC_BASE IOMEM(0xE0000000) 39 - #define MSM_VIC_PHYS 0xC0080000 40 - #define MSM_VIC_SIZE SZ_4K 41 - 42 - #define MSM7X30_CSR_PHYS 0xC0100000 43 - #define MSM7X30_CSR_SIZE SZ_4K 44 - 45 - #define MSM_DMOV_BASE IOMEM(0xE0002000) 46 - #define MSM_DMOV_PHYS 0xAC400000 47 - #define MSM_DMOV_SIZE SZ_4K 48 - 49 - #define MSM7X30_GPIO1_PHYS 0xAC001000 50 - #define MSM7X30_GPIO1_SIZE SZ_4K 51 - 52 - #define MSM7X30_GPIO2_PHYS 0xAC101000 53 - #define MSM7X30_GPIO2_SIZE SZ_4K 54 - 55 - #define MSM_CLK_CTL_BASE IOMEM(0xE0005000) 56 - #define MSM_CLK_CTL_PHYS 0xAB800000 57 - #define MSM_CLK_CTL_SIZE SZ_4K 58 - 59 - #define MSM_CLK_CTL_SH2_BASE IOMEM(0xE0006000) 60 - #define MSM_CLK_CTL_SH2_PHYS 0xABA01000 61 - #define MSM_CLK_CTL_SH2_SIZE SZ_4K 62 - 63 - #define MSM_ACC_BASE IOMEM(0xE0007000) 64 - #define MSM_ACC_PHYS 0xC0101000 65 - #define MSM_ACC_SIZE SZ_4K 66 - 67 - #define MSM_SAW_BASE IOMEM(0xE0008000) 68 - #define MSM_SAW_PHYS 0xC0102000 69 - #define MSM_SAW_SIZE SZ_4K 70 - 71 - #define MSM_GCC_BASE IOMEM(0xE0009000) 72 - #define MSM_GCC_PHYS 0xC0182000 73 - #define MSM_GCC_SIZE SZ_4K 74 - 75 - #define MSM_TCSR_BASE IOMEM(0xE000A000) 76 - #define MSM_TCSR_PHYS 0xAB600000 77 - #define MSM_TCSR_SIZE SZ_4K 78 - 79 - #define MSM_SHARED_RAM_BASE IOMEM(0xE0100000) 80 - #define MSM_SHARED_RAM_PHYS 0x00100000 81 - #define MSM_SHARED_RAM_SIZE SZ_1M 82 - 83 - #define MSM_UART1_PHYS 0xACA00000 84 - #define MSM_UART1_SIZE SZ_4K 85 - 86 - #define MSM_UART2_PHYS 0xACB00000 87 - #define MSM_UART2_SIZE SZ_4K 88 - 89 - #define MSM_UART3_PHYS 0xACC00000 90 - #define MSM_UART3_SIZE SZ_4K 91 - 92 - #define MSM_MDC_BASE IOMEM(0xE0200000) 93 - #define MSM_MDC_PHYS 0xAA500000 94 - #define MSM_MDC_SIZE SZ_1M 95 - 96 - #define MSM_AD5_BASE IOMEM(0xE0300000) 97 - #define MSM_AD5_PHYS 0xA7000000 98 - #define MSM_AD5_SIZE (SZ_1M*13) 99 - 100 - #define MSM_HSUSB_PHYS 0xA3600000 101 - #define MSM_HSUSB_SIZE SZ_1K 102 - 103 - #endif
-125
arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
··· 1 - /* 2 - * Copyright (C) 2007 Google, Inc. 3 - * Copyright (c) 2008-2011 Code Aurora Forum. All rights reserved. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * 16 - * The MSM peripherals are spread all over across 768MB of physical 17 - * space, which makes just having a simple IO_ADDRESS macro to slide 18 - * them into the right virtual location rough. Instead, we will 19 - * provide a master phys->virt mapping for peripherals here. 20 - * 21 - */ 22 - 23 - #ifndef __ASM_ARCH_MSM_IOMAP_8X50_H 24 - #define __ASM_ARCH_MSM_IOMAP_8X50_H 25 - 26 - /* Physical base address and size of peripherals. 27 - * Ordered by the virtual base addresses they will be mapped at. 28 - * 29 - * MSM_VIC_BASE must be an value that can be loaded via a "mov" 30 - * instruction, otherwise entry-macro.S will not compile. 31 - * 32 - * If you add or remove entries here, you'll want to edit the 33 - * msm_io_desc array in arch/arm/mach-msm/io.c to reflect your 34 - * changes. 35 - * 36 - */ 37 - 38 - #define MSM_VIC_BASE IOMEM(0xE0000000) 39 - #define MSM_VIC_PHYS 0xAC000000 40 - #define MSM_VIC_SIZE SZ_4K 41 - 42 - #define QSD8X50_CSR_PHYS 0xAC100000 43 - #define QSD8X50_CSR_SIZE SZ_4K 44 - 45 - #define MSM_DMOV_BASE IOMEM(0xE0002000) 46 - #define MSM_DMOV_PHYS 0xA9700000 47 - #define MSM_DMOV_SIZE SZ_4K 48 - 49 - #define QSD8X50_GPIO1_PHYS 0xA9000000 50 - #define QSD8X50_GPIO1_SIZE SZ_4K 51 - 52 - #define QSD8X50_GPIO2_PHYS 0xA9100000 53 - #define QSD8X50_GPIO2_SIZE SZ_4K 54 - 55 - #define MSM_CLK_CTL_BASE IOMEM(0xE0005000) 56 - #define MSM_CLK_CTL_PHYS 0xA8600000 57 - #define MSM_CLK_CTL_SIZE SZ_4K 58 - 59 - #define MSM_SIRC_BASE IOMEM(0xE1006000) 60 - #define MSM_SIRC_PHYS 0xAC200000 61 - #define MSM_SIRC_SIZE SZ_4K 62 - 63 - #define MSM_SCPLL_BASE IOMEM(0xE1007000) 64 - #define MSM_SCPLL_PHYS 0xA8800000 65 - #define MSM_SCPLL_SIZE SZ_4K 66 - 67 - #ifdef CONFIG_MSM_SOC_REV_A 68 - #define MSM_SMI_BASE 0xE0000000 69 - #else 70 - #define MSM_SMI_BASE 0x00000000 71 - #endif 72 - 73 - #define MSM_SHARED_RAM_BASE IOMEM(0xE0100000) 74 - #define MSM_SHARED_RAM_PHYS (MSM_SMI_BASE + 0x00100000) 75 - #define MSM_SHARED_RAM_SIZE SZ_1M 76 - 77 - #define MSM_UART1_PHYS 0xA9A00000 78 - #define MSM_UART1_SIZE SZ_4K 79 - 80 - #define MSM_UART2_PHYS 0xA9B00000 81 - #define MSM_UART2_SIZE SZ_4K 82 - 83 - #define MSM_UART3_PHYS 0xA9C00000 84 - #define MSM_UART3_SIZE SZ_4K 85 - 86 - #define MSM_MDC_BASE IOMEM(0xE0200000) 87 - #define MSM_MDC_PHYS 0xAA500000 88 - #define MSM_MDC_SIZE SZ_1M 89 - 90 - #define MSM_AD5_BASE IOMEM(0xE0300000) 91 - #define MSM_AD5_PHYS 0xAC000000 92 - #define MSM_AD5_SIZE (SZ_1M*13) 93 - 94 - 95 - #define MSM_I2C_SIZE SZ_4K 96 - #define MSM_I2C_PHYS 0xA9900000 97 - 98 - #define MSM_HSUSB_PHYS 0xA0800000 99 - #define MSM_HSUSB_SIZE SZ_1K 100 - 101 - #define MSM_NAND_PHYS 0xA0A00000 102 - 103 - 104 - #define MSM_TSIF_PHYS (0xa0100000) 105 - #define MSM_TSIF_SIZE (0x200) 106 - 107 - #define MSM_TSSC_PHYS 0xAA300000 108 - 109 - #define MSM_UART1DM_PHYS 0xA0200000 110 - #define MSM_UART2DM_PHYS 0xA0900000 111 - 112 - 113 - #define MSM_SDC1_PHYS 0xA0300000 114 - #define MSM_SDC1_SIZE SZ_4K 115 - 116 - #define MSM_SDC2_PHYS 0xA0400000 117 - #define MSM_SDC2_SIZE SZ_4K 118 - 119 - #define MSM_SDC3_PHYS 0xA0500000 120 - #define MSM_SDC3_SIZE SZ_4K 121 - 122 - #define MSM_SDC4_PHYS 0xA0600000 123 - #define MSM_SDC4_SIZE SZ_4K 124 - 125 - #endif
-53
arch/arm/mach-msm/include/mach/msm_iomap.h
··· 1 - /* 2 - * Copyright (C) 2007 Google, Inc. 3 - * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * 16 - * The MSM peripherals are spread all over across 768MB of physical 17 - * space, which makes just having a simple IO_ADDRESS macro to slide 18 - * them into the right virtual location rough. Instead, we will 19 - * provide a master phys->virt mapping for peripherals here. 20 - * 21 - */ 22 - 23 - #ifndef __ASM_ARCH_MSM_IOMAP_H 24 - #define __ASM_ARCH_MSM_IOMAP_H 25 - 26 - #include <asm/sizes.h> 27 - 28 - /* Physical base address and size of peripherals. 29 - * Ordered by the virtual base addresses they will be mapped at. 30 - * 31 - * MSM_VIC_BASE must be an value that can be loaded via a "mov" 32 - * instruction, otherwise entry-macro.S will not compile. 33 - * 34 - * If you add or remove entries here, you'll want to edit the 35 - * msm_io_desc array in arch/arm/mach-msm/io.c to reflect your 36 - * changes. 37 - * 38 - */ 39 - 40 - #if defined(CONFIG_ARCH_MSM7X30) 41 - #include "msm_iomap-7x30.h" 42 - #elif defined(CONFIG_ARCH_QSD8X50) 43 - #include "msm_iomap-8x50.h" 44 - #else 45 - #include "msm_iomap-7x00.h" 46 - #endif 47 - 48 - /* Virtual addresses shared across all MSM targets. */ 49 - #define MSM_CSR_BASE IOMEM(0xE0001000) 50 - #define MSM_GPIO1_BASE IOMEM(0xE0003000) 51 - #define MSM_GPIO2_BASE IOMEM(0xE0004000) 52 - 53 - #endif
-109
arch/arm/mach-msm/include/mach/msm_smd.h
··· 1 - /* linux/include/asm-arm/arch-msm/msm_smd.h 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - 17 - #ifndef __ASM_ARCH_MSM_SMD_H 18 - #define __ASM_ARCH_MSM_SMD_H 19 - 20 - typedef struct smd_channel smd_channel_t; 21 - 22 - extern int (*msm_check_for_modem_crash)(void); 23 - 24 - /* warning: notify() may be called before open returns */ 25 - int smd_open(const char *name, smd_channel_t **ch, void *priv, 26 - void (*notify)(void *priv, unsigned event)); 27 - 28 - #define SMD_EVENT_DATA 1 29 - #define SMD_EVENT_OPEN 2 30 - #define SMD_EVENT_CLOSE 3 31 - 32 - int smd_close(smd_channel_t *ch); 33 - 34 - /* passing a null pointer for data reads and discards */ 35 - int smd_read(smd_channel_t *ch, void *data, int len); 36 - 37 - /* Write to stream channels may do a partial write and return 38 - ** the length actually written. 39 - ** Write to packet channels will never do a partial write -- 40 - ** it will return the requested length written or an error. 41 - */ 42 - int smd_write(smd_channel_t *ch, const void *data, int len); 43 - int smd_write_atomic(smd_channel_t *ch, const void *data, int len); 44 - 45 - int smd_write_avail(smd_channel_t *ch); 46 - int smd_read_avail(smd_channel_t *ch); 47 - 48 - /* Returns the total size of the current packet being read. 49 - ** Returns 0 if no packets available or a stream channel. 50 - */ 51 - int smd_cur_packet_size(smd_channel_t *ch); 52 - 53 - /* used for tty unthrottling and the like -- causes the notify() 54 - ** callback to be called from the same lock context as is used 55 - ** when it is called from channel updates 56 - */ 57 - void smd_kick(smd_channel_t *ch); 58 - 59 - 60 - #if 0 61 - /* these are interruptable waits which will block you until the specified 62 - ** number of bytes are readable or writable. 63 - */ 64 - int smd_wait_until_readable(smd_channel_t *ch, int bytes); 65 - int smd_wait_until_writable(smd_channel_t *ch, int bytes); 66 - #endif 67 - 68 - typedef enum { 69 - SMD_PORT_DS = 0, 70 - SMD_PORT_DIAG, 71 - SMD_PORT_RPC_CALL, 72 - SMD_PORT_RPC_REPLY, 73 - SMD_PORT_BT, 74 - SMD_PORT_CONTROL, 75 - SMD_PORT_MEMCPY_SPARE1, 76 - SMD_PORT_DATA1, 77 - SMD_PORT_DATA2, 78 - SMD_PORT_DATA3, 79 - SMD_PORT_DATA4, 80 - SMD_PORT_DATA5, 81 - SMD_PORT_DATA6, 82 - SMD_PORT_DATA7, 83 - SMD_PORT_DATA8, 84 - SMD_PORT_DATA9, 85 - SMD_PORT_DATA10, 86 - SMD_PORT_DATA11, 87 - SMD_PORT_DATA12, 88 - SMD_PORT_DATA13, 89 - SMD_PORT_DATA14, 90 - SMD_PORT_DATA15, 91 - SMD_PORT_DATA16, 92 - SMD_PORT_DATA17, 93 - SMD_PORT_DATA18, 94 - SMD_PORT_DATA19, 95 - SMD_PORT_DATA20, 96 - SMD_PORT_GPS_NMEA, 97 - SMD_PORT_BRIDGE_1, 98 - SMD_PORT_BRIDGE_2, 99 - SMD_PORT_BRIDGE_3, 100 - SMD_PORT_BRIDGE_4, 101 - SMD_PORT_BRIDGE_5, 102 - SMD_PORT_LOOPBACK, 103 - SMD_PORT_CS_APPS_MODEM, 104 - SMD_PORT_CS_APPS_DSP, 105 - SMD_PORT_CS_MODEM_DSP, 106 - SMD_NUM_PORTS, 107 - } smd_port_id_type; 108 - 109 - #endif
-98
arch/arm/mach-msm/include/mach/sirc.h
··· 1 - /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - */ 12 - 13 - #ifndef __ASM_ARCH_MSM_SIRC_H 14 - #define __ASM_ARCH_MSM_SIRC_H 15 - 16 - struct sirc_regs_t { 17 - void *int_enable; 18 - void *int_enable_clear; 19 - void *int_enable_set; 20 - void *int_type; 21 - void *int_polarity; 22 - void *int_clear; 23 - }; 24 - 25 - struct sirc_cascade_regs { 26 - void *int_status; 27 - unsigned int cascade_irq; 28 - }; 29 - 30 - void msm_init_sirc(void); 31 - void msm_sirc_enter_sleep(void); 32 - void msm_sirc_exit_sleep(void); 33 - 34 - #if defined(CONFIG_ARCH_MSM_SCORPION) 35 - 36 - #include <mach/msm_iomap.h> 37 - 38 - /* 39 - * Secondary interrupt controller interrupts 40 - */ 41 - 42 - #define FIRST_SIRC_IRQ (NR_MSM_IRQS + NR_GPIO_IRQS) 43 - 44 - #define INT_UART1 (FIRST_SIRC_IRQ + 0) 45 - #define INT_UART2 (FIRST_SIRC_IRQ + 1) 46 - #define INT_UART3 (FIRST_SIRC_IRQ + 2) 47 - #define INT_UART1_RX (FIRST_SIRC_IRQ + 3) 48 - #define INT_UART2_RX (FIRST_SIRC_IRQ + 4) 49 - #define INT_UART3_RX (FIRST_SIRC_IRQ + 5) 50 - #define INT_SPI_INPUT (FIRST_SIRC_IRQ + 6) 51 - #define INT_SPI_OUTPUT (FIRST_SIRC_IRQ + 7) 52 - #define INT_SPI_ERROR (FIRST_SIRC_IRQ + 8) 53 - #define INT_GPIO_GROUP1 (FIRST_SIRC_IRQ + 9) 54 - #define INT_GPIO_GROUP2 (FIRST_SIRC_IRQ + 10) 55 - #define INT_GPIO_GROUP1_SECURE (FIRST_SIRC_IRQ + 11) 56 - #define INT_GPIO_GROUP2_SECURE (FIRST_SIRC_IRQ + 12) 57 - #define INT_AVS_SVIC (FIRST_SIRC_IRQ + 13) 58 - #define INT_AVS_REQ_UP (FIRST_SIRC_IRQ + 14) 59 - #define INT_AVS_REQ_DOWN (FIRST_SIRC_IRQ + 15) 60 - #define INT_PBUS_ERR (FIRST_SIRC_IRQ + 16) 61 - #define INT_AXI_ERR (FIRST_SIRC_IRQ + 17) 62 - #define INT_SMI_ERR (FIRST_SIRC_IRQ + 18) 63 - #define INT_EBI1_ERR (FIRST_SIRC_IRQ + 19) 64 - #define INT_IMEM_ERR (FIRST_SIRC_IRQ + 20) 65 - #define INT_TEMP_SENSOR (FIRST_SIRC_IRQ + 21) 66 - #define INT_TV_ENC (FIRST_SIRC_IRQ + 22) 67 - #define INT_GRP2D (FIRST_SIRC_IRQ + 23) 68 - #define INT_GSBI_QUP (FIRST_SIRC_IRQ + 24) 69 - #define INT_SC_ACG (FIRST_SIRC_IRQ + 25) 70 - #define INT_WDT0 (FIRST_SIRC_IRQ + 26) 71 - #define INT_WDT1 (FIRST_SIRC_IRQ + 27) 72 - 73 - #if defined(CONFIG_MSM_SOC_REV_A) 74 - #define NR_SIRC_IRQS 28 75 - #define SIRC_MASK 0x0FFFFFFF 76 - #else 77 - #define NR_SIRC_IRQS 23 78 - #define SIRC_MASK 0x007FFFFF 79 - #endif 80 - 81 - #define LAST_SIRC_IRQ (FIRST_SIRC_IRQ + NR_SIRC_IRQS - 1) 82 - 83 - #define SPSS_SIRC_INT_SELECT (MSM_SIRC_BASE + 0x00) 84 - #define SPSS_SIRC_INT_ENABLE (MSM_SIRC_BASE + 0x04) 85 - #define SPSS_SIRC_INT_ENABLE_CLEAR (MSM_SIRC_BASE + 0x08) 86 - #define SPSS_SIRC_INT_ENABLE_SET (MSM_SIRC_BASE + 0x0C) 87 - #define SPSS_SIRC_INT_TYPE (MSM_SIRC_BASE + 0x10) 88 - #define SPSS_SIRC_INT_POLARITY (MSM_SIRC_BASE + 0x14) 89 - #define SPSS_SIRC_SECURITY (MSM_SIRC_BASE + 0x18) 90 - #define SPSS_SIRC_IRQ_STATUS (MSM_SIRC_BASE + 0x1C) 91 - #define SPSS_SIRC_IRQ1_STATUS (MSM_SIRC_BASE + 0x20) 92 - #define SPSS_SIRC_RAW_STATUS (MSM_SIRC_BASE + 0x24) 93 - #define SPSS_SIRC_INT_CLEAR (MSM_SIRC_BASE + 0x28) 94 - #define SPSS_SIRC_SOFT_INT (MSM_SIRC_BASE + 0x2C) 95 - 96 - #endif 97 - 98 - #endif
-29
arch/arm/mach-msm/include/mach/vreg.h
··· 1 - /* linux/include/asm-arm/arch-msm/vreg.h 2 - * 3 - * Copyright (C) 2008 Google, Inc. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - 17 - #ifndef __ARCH_ARM_MACH_MSM_VREG_H 18 - #define __ARCH_ARM_MACH_MSM_VREG_H 19 - 20 - struct vreg; 21 - 22 - struct vreg *vreg_get(struct device *dev, const char *id); 23 - void vreg_put(struct vreg *vreg); 24 - 25 - int vreg_enable(struct vreg *vreg); 26 - int vreg_disable(struct vreg *vreg); 27 - int vreg_set_level(struct vreg *vreg, unsigned mv); 28 - 29 - #endif
-161
arch/arm/mach-msm/io.c
··· 1 - /* arch/arm/mach-msm/io.c 2 - * 3 - * MSM7K, QSD io support 4 - * 5 - * Copyright (C) 2007 Google, Inc. 6 - * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved. 7 - * Author: Brian Swetland <swetland@google.com> 8 - * 9 - * This software is licensed under the terms of the GNU General Public 10 - * License version 2, as published by the Free Software Foundation, and 11 - * may be copied, distributed, and modified under those terms. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - */ 19 - 20 - #include <linux/kernel.h> 21 - #include <linux/bug.h> 22 - #include <linux/init.h> 23 - #include <linux/io.h> 24 - #include <linux/export.h> 25 - 26 - #include <mach/hardware.h> 27 - #include <asm/page.h> 28 - #include <mach/msm_iomap.h> 29 - #include <asm/mach/map.h> 30 - 31 - #include "common.h" 32 - 33 - #define MSM_CHIP_DEVICE_TYPE(name, chip, mem_type) { \ 34 - .virtual = (unsigned long) MSM_##name##_BASE, \ 35 - .pfn = __phys_to_pfn(chip##_##name##_PHYS), \ 36 - .length = chip##_##name##_SIZE, \ 37 - .type = mem_type, \ 38 - } 39 - 40 - #define MSM_DEVICE_TYPE(name, mem_type) \ 41 - MSM_CHIP_DEVICE_TYPE(name, MSM, mem_type) 42 - #define MSM_CHIP_DEVICE(name, chip) \ 43 - MSM_CHIP_DEVICE_TYPE(name, chip, MT_DEVICE) 44 - #define MSM_DEVICE(name) MSM_CHIP_DEVICE(name, MSM) 45 - 46 - #if defined(CONFIG_ARCH_MSM7X00A) 47 - static struct map_desc msm_io_desc[] __initdata = { 48 - MSM_DEVICE_TYPE(VIC, MT_DEVICE_NONSHARED), 49 - MSM_CHIP_DEVICE_TYPE(CSR, MSM7X00, MT_DEVICE_NONSHARED), 50 - MSM_DEVICE_TYPE(DMOV, MT_DEVICE_NONSHARED), 51 - MSM_CHIP_DEVICE_TYPE(GPIO1, MSM7X00, MT_DEVICE_NONSHARED), 52 - MSM_CHIP_DEVICE_TYPE(GPIO2, MSM7X00, MT_DEVICE_NONSHARED), 53 - MSM_DEVICE_TYPE(CLK_CTL, MT_DEVICE_NONSHARED), 54 - { 55 - .virtual = (unsigned long) MSM_SHARED_RAM_BASE, 56 - .pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS), 57 - .length = MSM_SHARED_RAM_SIZE, 58 - .type = MT_DEVICE, 59 - }, 60 - #if defined(CONFIG_DEBUG_MSM_UART) 61 - { 62 - /* Must be last: virtual and pfn filled in by debug_ll_addr() */ 63 - .length = SZ_4K, 64 - .type = MT_DEVICE_NONSHARED, 65 - } 66 - #endif 67 - }; 68 - 69 - void __init msm_map_common_io(void) 70 - { 71 - size_t size = ARRAY_SIZE(msm_io_desc); 72 - 73 - /* Make sure the peripheral register window is closed, since 74 - * we will use PTE flags (TEX[1]=1,B=0,C=1) to determine which 75 - * pages are peripheral interface or not. 76 - */ 77 - asm("mcr p15, 0, %0, c15, c2, 4" : : "r" (0)); 78 - #if defined(CONFIG_DEBUG_MSM_UART) 79 - #ifdef CONFIG_MMU 80 - debug_ll_addr(&msm_io_desc[size - 1].pfn, 81 - &msm_io_desc[size - 1].virtual); 82 - #endif 83 - msm_io_desc[size - 1].pfn = __phys_to_pfn(msm_io_desc[size - 1].pfn); 84 - #endif 85 - iotable_init(msm_io_desc, size); 86 - } 87 - #endif 88 - 89 - #ifdef CONFIG_ARCH_QSD8X50 90 - static struct map_desc qsd8x50_io_desc[] __initdata = { 91 - MSM_DEVICE(VIC), 92 - MSM_CHIP_DEVICE(CSR, QSD8X50), 93 - MSM_DEVICE(DMOV), 94 - MSM_CHIP_DEVICE(GPIO1, QSD8X50), 95 - MSM_CHIP_DEVICE(GPIO2, QSD8X50), 96 - MSM_DEVICE(CLK_CTL), 97 - MSM_DEVICE(SIRC), 98 - MSM_DEVICE(SCPLL), 99 - MSM_DEVICE(AD5), 100 - MSM_DEVICE(MDC), 101 - { 102 - .virtual = (unsigned long) MSM_SHARED_RAM_BASE, 103 - .pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS), 104 - .length = MSM_SHARED_RAM_SIZE, 105 - .type = MT_DEVICE, 106 - }, 107 - }; 108 - 109 - void __init msm_map_qsd8x50_io(void) 110 - { 111 - debug_ll_io_init(); 112 - iotable_init(qsd8x50_io_desc, ARRAY_SIZE(qsd8x50_io_desc)); 113 - } 114 - #endif /* CONFIG_ARCH_QSD8X50 */ 115 - 116 - #ifdef CONFIG_ARCH_MSM7X30 117 - static struct map_desc msm7x30_io_desc[] __initdata = { 118 - MSM_DEVICE(VIC), 119 - MSM_CHIP_DEVICE(CSR, MSM7X30), 120 - MSM_DEVICE(DMOV), 121 - MSM_CHIP_DEVICE(GPIO1, MSM7X30), 122 - MSM_CHIP_DEVICE(GPIO2, MSM7X30), 123 - MSM_DEVICE(CLK_CTL), 124 - MSM_DEVICE(CLK_CTL_SH2), 125 - MSM_DEVICE(AD5), 126 - MSM_DEVICE(MDC), 127 - MSM_DEVICE(ACC), 128 - MSM_DEVICE(SAW), 129 - MSM_DEVICE(GCC), 130 - MSM_DEVICE(TCSR), 131 - { 132 - .virtual = (unsigned long) MSM_SHARED_RAM_BASE, 133 - .pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS), 134 - .length = MSM_SHARED_RAM_SIZE, 135 - .type = MT_DEVICE, 136 - }, 137 - }; 138 - 139 - void __init msm_map_msm7x30_io(void) 140 - { 141 - debug_ll_io_init(); 142 - iotable_init(msm7x30_io_desc, ARRAY_SIZE(msm7x30_io_desc)); 143 - } 144 - #endif /* CONFIG_ARCH_MSM7X30 */ 145 - 146 - #ifdef CONFIG_ARCH_MSM7X00A 147 - void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size, 148 - unsigned int mtype, void *caller) 149 - { 150 - if (mtype == MT_DEVICE) { 151 - /* The peripherals in the 88000000 - D0000000 range 152 - * are only accessible by type MT_DEVICE_NONSHARED. 153 - * Adjust mtype as necessary to make this "just work." 154 - */ 155 - if ((phys_addr >= 0x88000000) && (phys_addr < 0xD0000000)) 156 - mtype = MT_DEVICE_NONSHARED; 157 - } 158 - 159 - return __arm_ioremap_caller(phys_addr, size, mtype, caller); 160 - } 161 - #endif
-363
arch/arm/mach-msm/irq-vic.c
··· 1 - /* 2 - * Copyright (C) 2007 Google, Inc. 3 - * Copyright (c) 2009, Code Aurora Forum. All rights reserved. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #include <linux/init.h> 17 - #include <linux/module.h> 18 - #include <linux/sched.h> 19 - #include <linux/interrupt.h> 20 - #include <linux/ptrace.h> 21 - #include <linux/timer.h> 22 - #include <linux/irq.h> 23 - #include <linux/io.h> 24 - 25 - #include <asm/cacheflush.h> 26 - 27 - #include <mach/hardware.h> 28 - 29 - #include <mach/msm_iomap.h> 30 - 31 - #include "smd_private.h" 32 - 33 - enum { 34 - IRQ_DEBUG_SLEEP_INT_TRIGGER = 1U << 0, 35 - IRQ_DEBUG_SLEEP_INT = 1U << 1, 36 - IRQ_DEBUG_SLEEP_ABORT = 1U << 2, 37 - IRQ_DEBUG_SLEEP = 1U << 3, 38 - IRQ_DEBUG_SLEEP_REQUEST = 1U << 4, 39 - }; 40 - static int msm_irq_debug_mask; 41 - module_param_named(debug_mask, msm_irq_debug_mask, int, 42 - S_IRUGO | S_IWUSR | S_IWGRP); 43 - 44 - #define VIC_REG(off) (MSM_VIC_BASE + (off)) 45 - #define VIC_INT_TO_REG_ADDR(base, irq) (base + (irq / 32) * 4) 46 - #define VIC_INT_TO_REG_INDEX(irq) ((irq >> 5) & 3) 47 - 48 - #define VIC_INT_SELECT0 VIC_REG(0x0000) /* 1: FIQ, 0: IRQ */ 49 - #define VIC_INT_SELECT1 VIC_REG(0x0004) /* 1: FIQ, 0: IRQ */ 50 - #define VIC_INT_SELECT2 VIC_REG(0x0008) /* 1: FIQ, 0: IRQ */ 51 - #define VIC_INT_SELECT3 VIC_REG(0x000C) /* 1: FIQ, 0: IRQ */ 52 - #define VIC_INT_EN0 VIC_REG(0x0010) 53 - #define VIC_INT_EN1 VIC_REG(0x0014) 54 - #define VIC_INT_EN2 VIC_REG(0x0018) 55 - #define VIC_INT_EN3 VIC_REG(0x001C) 56 - #define VIC_INT_ENCLEAR0 VIC_REG(0x0020) 57 - #define VIC_INT_ENCLEAR1 VIC_REG(0x0024) 58 - #define VIC_INT_ENCLEAR2 VIC_REG(0x0028) 59 - #define VIC_INT_ENCLEAR3 VIC_REG(0x002C) 60 - #define VIC_INT_ENSET0 VIC_REG(0x0030) 61 - #define VIC_INT_ENSET1 VIC_REG(0x0034) 62 - #define VIC_INT_ENSET2 VIC_REG(0x0038) 63 - #define VIC_INT_ENSET3 VIC_REG(0x003C) 64 - #define VIC_INT_TYPE0 VIC_REG(0x0040) /* 1: EDGE, 0: LEVEL */ 65 - #define VIC_INT_TYPE1 VIC_REG(0x0044) /* 1: EDGE, 0: LEVEL */ 66 - #define VIC_INT_TYPE2 VIC_REG(0x0048) /* 1: EDGE, 0: LEVEL */ 67 - #define VIC_INT_TYPE3 VIC_REG(0x004C) /* 1: EDGE, 0: LEVEL */ 68 - #define VIC_INT_POLARITY0 VIC_REG(0x0050) /* 1: NEG, 0: POS */ 69 - #define VIC_INT_POLARITY1 VIC_REG(0x0054) /* 1: NEG, 0: POS */ 70 - #define VIC_INT_POLARITY2 VIC_REG(0x0058) /* 1: NEG, 0: POS */ 71 - #define VIC_INT_POLARITY3 VIC_REG(0x005C) /* 1: NEG, 0: POS */ 72 - #define VIC_NO_PEND_VAL VIC_REG(0x0060) 73 - 74 - #if defined(CONFIG_ARCH_MSM_SCORPION) 75 - #define VIC_NO_PEND_VAL_FIQ VIC_REG(0x0064) 76 - #define VIC_INT_MASTEREN VIC_REG(0x0068) /* 1: IRQ, 2: FIQ */ 77 - #define VIC_CONFIG VIC_REG(0x006C) /* 1: USE SC VIC */ 78 - #else 79 - #define VIC_INT_MASTEREN VIC_REG(0x0064) /* 1: IRQ, 2: FIQ */ 80 - #define VIC_PROTECTION VIC_REG(0x006C) /* 1: ENABLE */ 81 - #define VIC_CONFIG VIC_REG(0x0068) /* 1: USE ARM1136 VIC */ 82 - #endif 83 - 84 - #define VIC_IRQ_STATUS0 VIC_REG(0x0080) 85 - #define VIC_IRQ_STATUS1 VIC_REG(0x0084) 86 - #define VIC_IRQ_STATUS2 VIC_REG(0x0088) 87 - #define VIC_IRQ_STATUS3 VIC_REG(0x008C) 88 - #define VIC_FIQ_STATUS0 VIC_REG(0x0090) 89 - #define VIC_FIQ_STATUS1 VIC_REG(0x0094) 90 - #define VIC_FIQ_STATUS2 VIC_REG(0x0098) 91 - #define VIC_FIQ_STATUS3 VIC_REG(0x009C) 92 - #define VIC_RAW_STATUS0 VIC_REG(0x00A0) 93 - #define VIC_RAW_STATUS1 VIC_REG(0x00A4) 94 - #define VIC_RAW_STATUS2 VIC_REG(0x00A8) 95 - #define VIC_RAW_STATUS3 VIC_REG(0x00AC) 96 - #define VIC_INT_CLEAR0 VIC_REG(0x00B0) 97 - #define VIC_INT_CLEAR1 VIC_REG(0x00B4) 98 - #define VIC_INT_CLEAR2 VIC_REG(0x00B8) 99 - #define VIC_INT_CLEAR3 VIC_REG(0x00BC) 100 - #define VIC_SOFTINT0 VIC_REG(0x00C0) 101 - #define VIC_SOFTINT1 VIC_REG(0x00C4) 102 - #define VIC_SOFTINT2 VIC_REG(0x00C8) 103 - #define VIC_SOFTINT3 VIC_REG(0x00CC) 104 - #define VIC_IRQ_VEC_RD VIC_REG(0x00D0) /* pending int # */ 105 - #define VIC_IRQ_VEC_PEND_RD VIC_REG(0x00D4) /* pending vector addr */ 106 - #define VIC_IRQ_VEC_WR VIC_REG(0x00D8) 107 - 108 - #if defined(CONFIG_ARCH_MSM_SCORPION) 109 - #define VIC_FIQ_VEC_RD VIC_REG(0x00DC) 110 - #define VIC_FIQ_VEC_PEND_RD VIC_REG(0x00E0) 111 - #define VIC_FIQ_VEC_WR VIC_REG(0x00E4) 112 - #define VIC_IRQ_IN_SERVICE VIC_REG(0x00E8) 113 - #define VIC_IRQ_IN_STACK VIC_REG(0x00EC) 114 - #define VIC_FIQ_IN_SERVICE VIC_REG(0x00F0) 115 - #define VIC_FIQ_IN_STACK VIC_REG(0x00F4) 116 - #define VIC_TEST_BUS_SEL VIC_REG(0x00F8) 117 - #define VIC_IRQ_CTRL_CONFIG VIC_REG(0x00FC) 118 - #else 119 - #define VIC_IRQ_IN_SERVICE VIC_REG(0x00E0) 120 - #define VIC_IRQ_IN_STACK VIC_REG(0x00E4) 121 - #define VIC_TEST_BUS_SEL VIC_REG(0x00E8) 122 - #endif 123 - 124 - #define VIC_VECTPRIORITY(n) VIC_REG(0x0200+((n) * 4)) 125 - #define VIC_VECTADDR(n) VIC_REG(0x0400+((n) * 4)) 126 - 127 - #if defined(CONFIG_ARCH_MSM7X30) 128 - #define VIC_NUM_REGS 4 129 - #else 130 - #define VIC_NUM_REGS 2 131 - #endif 132 - 133 - #if VIC_NUM_REGS == 2 134 - #define DPRINT_REGS(base_reg, format, ...) \ 135 - printk(KERN_INFO format " %x %x\n", ##__VA_ARGS__, \ 136 - readl(base_reg ## 0), readl(base_reg ## 1)) 137 - #define DPRINT_ARRAY(array, format, ...) \ 138 - printk(KERN_INFO format " %x %x\n", ##__VA_ARGS__, \ 139 - array[0], array[1]) 140 - #elif VIC_NUM_REGS == 4 141 - #define DPRINT_REGS(base_reg, format, ...) \ 142 - printk(KERN_INFO format " %x %x %x %x\n", ##__VA_ARGS__, \ 143 - readl(base_reg ## 0), readl(base_reg ## 1), \ 144 - readl(base_reg ## 2), readl(base_reg ## 3)) 145 - #define DPRINT_ARRAY(array, format, ...) \ 146 - printk(KERN_INFO format " %x %x %x %x\n", ##__VA_ARGS__, \ 147 - array[0], array[1], \ 148 - array[2], array[3]) 149 - #else 150 - #error "VIC_NUM_REGS set to illegal value" 151 - #endif 152 - 153 - static uint32_t msm_irq_smsm_wake_enable[2]; 154 - static struct { 155 - uint32_t int_en[2]; 156 - uint32_t int_type; 157 - uint32_t int_polarity; 158 - uint32_t int_select; 159 - } msm_irq_shadow_reg[VIC_NUM_REGS]; 160 - static uint32_t msm_irq_idle_disable[VIC_NUM_REGS]; 161 - 162 - #define SMSM_FAKE_IRQ (0xff) 163 - static uint8_t msm_irq_to_smsm[NR_IRQS] = { 164 - [INT_MDDI_EXT] = 1, 165 - [INT_MDDI_PRI] = 2, 166 - [INT_MDDI_CLIENT] = 3, 167 - [INT_USB_OTG] = 4, 168 - 169 - [INT_PWB_I2C] = 5, 170 - [INT_SDC1_0] = 6, 171 - [INT_SDC1_1] = 7, 172 - [INT_SDC2_0] = 8, 173 - 174 - [INT_SDC2_1] = 9, 175 - [INT_ADSP_A9_A11] = 10, 176 - [INT_UART1] = 11, 177 - [INT_UART2] = 12, 178 - 179 - [INT_UART3] = 13, 180 - [INT_UART1_RX] = 14, 181 - [INT_UART2_RX] = 15, 182 - [INT_UART3_RX] = 16, 183 - 184 - [INT_UART1DM_IRQ] = 17, 185 - [INT_UART1DM_RX] = 18, 186 - [INT_KEYSENSE] = 19, 187 - #if !defined(CONFIG_ARCH_MSM7X30) 188 - [INT_AD_HSSD] = 20, 189 - #endif 190 - 191 - [INT_NAND_WR_ER_DONE] = 21, 192 - [INT_NAND_OP_DONE] = 22, 193 - [INT_TCHSCRN1] = 23, 194 - [INT_TCHSCRN2] = 24, 195 - 196 - [INT_TCHSCRN_SSBI] = 25, 197 - [INT_USB_HS] = 26, 198 - [INT_UART2DM_RX] = 27, 199 - [INT_UART2DM_IRQ] = 28, 200 - 201 - [INT_SDC4_1] = 29, 202 - [INT_SDC4_0] = 30, 203 - [INT_SDC3_1] = 31, 204 - [INT_SDC3_0] = 32, 205 - 206 - /* fake wakeup interrupts */ 207 - [INT_GPIO_GROUP1] = SMSM_FAKE_IRQ, 208 - [INT_GPIO_GROUP2] = SMSM_FAKE_IRQ, 209 - [INT_A9_M2A_0] = SMSM_FAKE_IRQ, 210 - [INT_A9_M2A_1] = SMSM_FAKE_IRQ, 211 - [INT_A9_M2A_5] = SMSM_FAKE_IRQ, 212 - [INT_GP_TIMER_EXP] = SMSM_FAKE_IRQ, 213 - [INT_DEBUG_TIMER_EXP] = SMSM_FAKE_IRQ, 214 - [INT_ADSP_A11] = SMSM_FAKE_IRQ, 215 - #ifdef CONFIG_ARCH_QSD8X50 216 - [INT_SIRC_0] = SMSM_FAKE_IRQ, 217 - [INT_SIRC_1] = SMSM_FAKE_IRQ, 218 - #endif 219 - }; 220 - 221 - static inline void msm_irq_write_all_regs(void __iomem *base, unsigned int val) 222 - { 223 - int i; 224 - 225 - for (i = 0; i < VIC_NUM_REGS; i++) 226 - writel(val, base + (i * 4)); 227 - } 228 - 229 - static void msm_irq_ack(struct irq_data *d) 230 - { 231 - void __iomem *reg = VIC_INT_TO_REG_ADDR(VIC_INT_CLEAR0, d->irq); 232 - writel(1 << (d->irq & 31), reg); 233 - } 234 - 235 - static void msm_irq_mask(struct irq_data *d) 236 - { 237 - void __iomem *reg = VIC_INT_TO_REG_ADDR(VIC_INT_ENCLEAR0, d->irq); 238 - unsigned index = VIC_INT_TO_REG_INDEX(d->irq); 239 - uint32_t mask = 1UL << (d->irq & 31); 240 - int smsm_irq = msm_irq_to_smsm[d->irq]; 241 - 242 - msm_irq_shadow_reg[index].int_en[0] &= ~mask; 243 - writel(mask, reg); 244 - if (smsm_irq == 0) 245 - msm_irq_idle_disable[index] &= ~mask; 246 - else { 247 - mask = 1UL << (smsm_irq - 1); 248 - msm_irq_smsm_wake_enable[0] &= ~mask; 249 - } 250 - } 251 - 252 - static void msm_irq_unmask(struct irq_data *d) 253 - { 254 - void __iomem *reg = VIC_INT_TO_REG_ADDR(VIC_INT_ENSET0, d->irq); 255 - unsigned index = VIC_INT_TO_REG_INDEX(d->irq); 256 - uint32_t mask = 1UL << (d->irq & 31); 257 - int smsm_irq = msm_irq_to_smsm[d->irq]; 258 - 259 - msm_irq_shadow_reg[index].int_en[0] |= mask; 260 - writel(mask, reg); 261 - 262 - if (smsm_irq == 0) 263 - msm_irq_idle_disable[index] |= mask; 264 - else { 265 - mask = 1UL << (smsm_irq - 1); 266 - msm_irq_smsm_wake_enable[0] |= mask; 267 - } 268 - } 269 - 270 - static int msm_irq_set_wake(struct irq_data *d, unsigned int on) 271 - { 272 - unsigned index = VIC_INT_TO_REG_INDEX(d->irq); 273 - uint32_t mask = 1UL << (d->irq & 31); 274 - int smsm_irq = msm_irq_to_smsm[d->irq]; 275 - 276 - if (smsm_irq == 0) { 277 - printk(KERN_ERR "msm_irq_set_wake: bad wakeup irq %d\n", d->irq); 278 - return -EINVAL; 279 - } 280 - if (on) 281 - msm_irq_shadow_reg[index].int_en[1] |= mask; 282 - else 283 - msm_irq_shadow_reg[index].int_en[1] &= ~mask; 284 - 285 - if (smsm_irq == SMSM_FAKE_IRQ) 286 - return 0; 287 - 288 - mask = 1UL << (smsm_irq - 1); 289 - if (on) 290 - msm_irq_smsm_wake_enable[1] |= mask; 291 - else 292 - msm_irq_smsm_wake_enable[1] &= ~mask; 293 - return 0; 294 - } 295 - 296 - static int msm_irq_set_type(struct irq_data *d, unsigned int flow_type) 297 - { 298 - void __iomem *treg = VIC_INT_TO_REG_ADDR(VIC_INT_TYPE0, d->irq); 299 - void __iomem *preg = VIC_INT_TO_REG_ADDR(VIC_INT_POLARITY0, d->irq); 300 - unsigned index = VIC_INT_TO_REG_INDEX(d->irq); 301 - int b = 1 << (d->irq & 31); 302 - uint32_t polarity; 303 - uint32_t type; 304 - 305 - polarity = msm_irq_shadow_reg[index].int_polarity; 306 - if (flow_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW)) 307 - polarity |= b; 308 - if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_HIGH)) 309 - polarity &= ~b; 310 - writel(polarity, preg); 311 - msm_irq_shadow_reg[index].int_polarity = polarity; 312 - 313 - type = msm_irq_shadow_reg[index].int_type; 314 - if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { 315 - type |= b; 316 - __irq_set_handler_locked(d->irq, handle_edge_irq); 317 - } 318 - if (flow_type & (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW)) { 319 - type &= ~b; 320 - __irq_set_handler_locked(d->irq, handle_level_irq); 321 - } 322 - writel(type, treg); 323 - msm_irq_shadow_reg[index].int_type = type; 324 - return 0; 325 - } 326 - 327 - static struct irq_chip msm_irq_chip = { 328 - .name = "msm", 329 - .irq_disable = msm_irq_mask, 330 - .irq_ack = msm_irq_ack, 331 - .irq_mask = msm_irq_mask, 332 - .irq_unmask = msm_irq_unmask, 333 - .irq_set_wake = msm_irq_set_wake, 334 - .irq_set_type = msm_irq_set_type, 335 - }; 336 - 337 - void __init msm_init_irq(void) 338 - { 339 - unsigned n; 340 - 341 - /* select level interrupts */ 342 - msm_irq_write_all_regs(VIC_INT_TYPE0, 0); 343 - 344 - /* select highlevel interrupts */ 345 - msm_irq_write_all_regs(VIC_INT_POLARITY0, 0); 346 - 347 - /* select IRQ for all INTs */ 348 - msm_irq_write_all_regs(VIC_INT_SELECT0, 0); 349 - 350 - /* disable all INTs */ 351 - msm_irq_write_all_regs(VIC_INT_EN0, 0); 352 - 353 - /* don't use vic */ 354 - writel(0, VIC_CONFIG); 355 - 356 - /* enable interrupt controller */ 357 - writel(3, VIC_INT_MASTEREN); 358 - 359 - for (n = 0; n < NR_MSM_IRQS; n++) { 360 - irq_set_chip_and_handler(n, &msm_irq_chip, handle_level_irq); 361 - set_irq_flags(n, IRQF_VALID); 362 - } 363 - }
-151
arch/arm/mach-msm/irq.c
··· 1 - /* linux/arch/arm/mach-msm/irq.c 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #include <linux/init.h> 17 - #include <linux/module.h> 18 - #include <linux/sched.h> 19 - #include <linux/interrupt.h> 20 - #include <linux/ptrace.h> 21 - #include <linux/timer.h> 22 - #include <linux/irq.h> 23 - #include <linux/io.h> 24 - 25 - #include <mach/hardware.h> 26 - 27 - #include <mach/msm_iomap.h> 28 - 29 - #define VIC_REG(off) (MSM_VIC_BASE + (off)) 30 - 31 - #define VIC_INT_SELECT0 VIC_REG(0x0000) /* 1: FIQ, 0: IRQ */ 32 - #define VIC_INT_SELECT1 VIC_REG(0x0004) /* 1: FIQ, 0: IRQ */ 33 - #define VIC_INT_EN0 VIC_REG(0x0010) 34 - #define VIC_INT_EN1 VIC_REG(0x0014) 35 - #define VIC_INT_ENCLEAR0 VIC_REG(0x0020) 36 - #define VIC_INT_ENCLEAR1 VIC_REG(0x0024) 37 - #define VIC_INT_ENSET0 VIC_REG(0x0030) 38 - #define VIC_INT_ENSET1 VIC_REG(0x0034) 39 - #define VIC_INT_TYPE0 VIC_REG(0x0040) /* 1: EDGE, 0: LEVEL */ 40 - #define VIC_INT_TYPE1 VIC_REG(0x0044) /* 1: EDGE, 0: LEVEL */ 41 - #define VIC_INT_POLARITY0 VIC_REG(0x0050) /* 1: NEG, 0: POS */ 42 - #define VIC_INT_POLARITY1 VIC_REG(0x0054) /* 1: NEG, 0: POS */ 43 - #define VIC_NO_PEND_VAL VIC_REG(0x0060) 44 - #define VIC_INT_MASTEREN VIC_REG(0x0064) /* 1: IRQ, 2: FIQ */ 45 - #define VIC_PROTECTION VIC_REG(0x006C) /* 1: ENABLE */ 46 - #define VIC_CONFIG VIC_REG(0x0068) /* 1: USE ARM1136 VIC */ 47 - #define VIC_IRQ_STATUS0 VIC_REG(0x0080) 48 - #define VIC_IRQ_STATUS1 VIC_REG(0x0084) 49 - #define VIC_FIQ_STATUS0 VIC_REG(0x0090) 50 - #define VIC_FIQ_STATUS1 VIC_REG(0x0094) 51 - #define VIC_RAW_STATUS0 VIC_REG(0x00A0) 52 - #define VIC_RAW_STATUS1 VIC_REG(0x00A4) 53 - #define VIC_INT_CLEAR0 VIC_REG(0x00B0) 54 - #define VIC_INT_CLEAR1 VIC_REG(0x00B4) 55 - #define VIC_SOFTINT0 VIC_REG(0x00C0) 56 - #define VIC_SOFTINT1 VIC_REG(0x00C4) 57 - #define VIC_IRQ_VEC_RD VIC_REG(0x00D0) /* pending int # */ 58 - #define VIC_IRQ_VEC_PEND_RD VIC_REG(0x00D4) /* pending vector addr */ 59 - #define VIC_IRQ_VEC_WR VIC_REG(0x00D8) 60 - #define VIC_IRQ_IN_SERVICE VIC_REG(0x00E0) 61 - #define VIC_IRQ_IN_STACK VIC_REG(0x00E4) 62 - #define VIC_TEST_BUS_SEL VIC_REG(0x00E8) 63 - 64 - #define VIC_VECTPRIORITY(n) VIC_REG(0x0200+((n) * 4)) 65 - #define VIC_VECTADDR(n) VIC_REG(0x0400+((n) * 4)) 66 - 67 - static void msm_irq_ack(struct irq_data *d) 68 - { 69 - void __iomem *reg = VIC_INT_CLEAR0 + ((d->irq & 32) ? 4 : 0); 70 - writel(1 << (d->irq & 31), reg); 71 - } 72 - 73 - static void msm_irq_mask(struct irq_data *d) 74 - { 75 - void __iomem *reg = VIC_INT_ENCLEAR0 + ((d->irq & 32) ? 4 : 0); 76 - writel(1 << (d->irq & 31), reg); 77 - } 78 - 79 - static void msm_irq_unmask(struct irq_data *d) 80 - { 81 - void __iomem *reg = VIC_INT_ENSET0 + ((d->irq & 32) ? 4 : 0); 82 - writel(1 << (d->irq & 31), reg); 83 - } 84 - 85 - static int msm_irq_set_wake(struct irq_data *d, unsigned int on) 86 - { 87 - return -EINVAL; 88 - } 89 - 90 - static int msm_irq_set_type(struct irq_data *d, unsigned int flow_type) 91 - { 92 - void __iomem *treg = VIC_INT_TYPE0 + ((d->irq & 32) ? 4 : 0); 93 - void __iomem *preg = VIC_INT_POLARITY0 + ((d->irq & 32) ? 4 : 0); 94 - int b = 1 << (d->irq & 31); 95 - 96 - if (flow_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW)) 97 - writel(readl(preg) | b, preg); 98 - if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_HIGH)) 99 - writel(readl(preg) & (~b), preg); 100 - 101 - if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { 102 - writel(readl(treg) | b, treg); 103 - __irq_set_handler_locked(d->irq, handle_edge_irq); 104 - } 105 - if (flow_type & (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW)) { 106 - writel(readl(treg) & (~b), treg); 107 - __irq_set_handler_locked(d->irq, handle_level_irq); 108 - } 109 - return 0; 110 - } 111 - 112 - static struct irq_chip msm_irq_chip = { 113 - .name = "msm", 114 - .irq_ack = msm_irq_ack, 115 - .irq_mask = msm_irq_mask, 116 - .irq_unmask = msm_irq_unmask, 117 - .irq_set_wake = msm_irq_set_wake, 118 - .irq_set_type = msm_irq_set_type, 119 - }; 120 - 121 - void __init msm_init_irq(void) 122 - { 123 - unsigned n; 124 - 125 - /* select level interrupts */ 126 - writel(0, VIC_INT_TYPE0); 127 - writel(0, VIC_INT_TYPE1); 128 - 129 - /* select highlevel interrupts */ 130 - writel(0, VIC_INT_POLARITY0); 131 - writel(0, VIC_INT_POLARITY1); 132 - 133 - /* select IRQ for all INTs */ 134 - writel(0, VIC_INT_SELECT0); 135 - writel(0, VIC_INT_SELECT1); 136 - 137 - /* disable all INTs */ 138 - writel(0, VIC_INT_EN0); 139 - writel(0, VIC_INT_EN1); 140 - 141 - /* don't use 1136 vic */ 142 - writel(0, VIC_CONFIG); 143 - 144 - /* enable interrupt controller */ 145 - writel(1, VIC_INT_MASTEREN); 146 - 147 - for (n = 0; n < NR_MSM_IRQS; n++) { 148 - irq_set_chip_and_handler(n, &msm_irq_chip, handle_level_irq); 149 - set_irq_flags(n, IRQF_VALID); 150 - } 151 - }
-71
arch/arm/mach-msm/last_radio_log.c
··· 1 - /* arch/arm/mach-msm/last_radio_log.c 2 - * 3 - * Extract the log from a modem crash though SMEM 4 - * 5 - * Copyright (C) 2007 Google, Inc. 6 - * 7 - * This software is licensed under the terms of the GNU General Public 8 - * License version 2, as published by the Free Software Foundation, and 9 - * may be copied, distributed, and modified under those terms. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - */ 17 - 18 - #include <linux/kernel.h> 19 - #include <linux/module.h> 20 - #include <linux/fs.h> 21 - #include <linux/proc_fs.h> 22 - #include <linux/uaccess.h> 23 - 24 - #include "smd_private.h" 25 - 26 - static void *radio_log_base; 27 - static size_t radio_log_size; 28 - 29 - extern void *smem_item(unsigned id, unsigned *size); 30 - 31 - static ssize_t last_radio_log_read(struct file *file, char __user *buf, 32 - size_t len, loff_t *offset) 33 - { 34 - return simple_read_from_buffer(buf, len, offset, 35 - radio_log_base, radio_log_size); 36 - } 37 - 38 - static struct file_operations last_radio_log_fops = { 39 - .read = last_radio_log_read, 40 - .llseek = default_llseek, 41 - }; 42 - 43 - void msm_init_last_radio_log(struct module *owner) 44 - { 45 - struct proc_dir_entry *entry; 46 - 47 - if (last_radio_log_fops.owner) { 48 - pr_err("%s: already claimed\n", __func__); 49 - return; 50 - } 51 - 52 - radio_log_base = smem_item(SMEM_CLKREGIM_BSP, &radio_log_size); 53 - if (!radio_log_base) { 54 - pr_err("%s: could not retrieve SMEM_CLKREGIM_BSP\n", __func__); 55 - return; 56 - } 57 - 58 - entry = proc_create("last_radio_log", S_IRUGO, NULL, 59 - &last_radio_log_fops); 60 - if (!entry) { 61 - pr_err("%s: could not create proc entry for radio log\n", 62 - __func__); 63 - return; 64 - } 65 - 66 - pr_err("%s: last radio log is %d bytes long\n", __func__, 67 - radio_log_size); 68 - last_radio_log_fops.owner = owner; 69 - proc_set_size(entry, radio_log_size); 70 - } 71 - EXPORT_SYMBOL(msm_init_last_radio_log);
-129
arch/arm/mach-msm/proc_comm.c
··· 1 - /* arch/arm/mach-msm/proc_comm.c 2 - * 3 - * Copyright (C) 2007-2008 Google, Inc. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - 17 - #include <linux/delay.h> 18 - #include <linux/errno.h> 19 - #include <linux/io.h> 20 - #include <linux/spinlock.h> 21 - #include <mach/msm_iomap.h> 22 - 23 - #include "proc_comm.h" 24 - 25 - static inline void msm_a2m_int(uint32_t irq) 26 - { 27 - #if defined(CONFIG_ARCH_MSM7X30) 28 - writel(1 << irq, MSM_GCC_BASE + 0x8); 29 - #else 30 - writel(1, MSM_CSR_BASE + 0x400 + (irq * 4)); 31 - #endif 32 - } 33 - 34 - static inline void notify_other_proc_comm(void) 35 - { 36 - msm_a2m_int(6); 37 - } 38 - 39 - #define APP_COMMAND 0x00 40 - #define APP_STATUS 0x04 41 - #define APP_DATA1 0x08 42 - #define APP_DATA2 0x0C 43 - 44 - #define MDM_COMMAND 0x10 45 - #define MDM_STATUS 0x14 46 - #define MDM_DATA1 0x18 47 - #define MDM_DATA2 0x1C 48 - 49 - static DEFINE_SPINLOCK(proc_comm_lock); 50 - 51 - /* The higher level SMD support will install this to 52 - * provide a way to check for and handle modem restart. 53 - */ 54 - int (*msm_check_for_modem_crash)(void); 55 - 56 - /* Poll for a state change, checking for possible 57 - * modem crashes along the way (so we don't wait 58 - * forever while the ARM9 is blowing up). 59 - * 60 - * Return an error in the event of a modem crash and 61 - * restart so the msm_proc_comm() routine can restart 62 - * the operation from the beginning. 63 - */ 64 - static int proc_comm_wait_for(void __iomem *addr, unsigned value) 65 - { 66 - for (;;) { 67 - if (readl(addr) == value) 68 - return 0; 69 - 70 - if (msm_check_for_modem_crash) 71 - if (msm_check_for_modem_crash()) 72 - return -EAGAIN; 73 - } 74 - } 75 - 76 - int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2) 77 - { 78 - void __iomem *base = MSM_SHARED_RAM_BASE; 79 - unsigned long flags; 80 - int ret; 81 - 82 - spin_lock_irqsave(&proc_comm_lock, flags); 83 - 84 - for (;;) { 85 - if (proc_comm_wait_for(base + MDM_STATUS, PCOM_READY)) 86 - continue; 87 - 88 - writel(cmd, base + APP_COMMAND); 89 - writel(data1 ? *data1 : 0, base + APP_DATA1); 90 - writel(data2 ? *data2 : 0, base + APP_DATA2); 91 - 92 - notify_other_proc_comm(); 93 - 94 - if (proc_comm_wait_for(base + APP_COMMAND, PCOM_CMD_DONE)) 95 - continue; 96 - 97 - if (readl(base + APP_STATUS) != PCOM_CMD_FAIL) { 98 - if (data1) 99 - *data1 = readl(base + APP_DATA1); 100 - if (data2) 101 - *data2 = readl(base + APP_DATA2); 102 - ret = 0; 103 - } else { 104 - ret = -EIO; 105 - } 106 - break; 107 - } 108 - 109 - writel(PCOM_CMD_IDLE, base + APP_COMMAND); 110 - 111 - spin_unlock_irqrestore(&proc_comm_lock, flags); 112 - 113 - return ret; 114 - } 115 - 116 - /* 117 - * We need to wait for the ARM9 to at least partially boot 118 - * up before we can continue. Since the ARM9 does resource 119 - * allocation, if we dont' wait we could end up crashing or in 120 - * and unknown state. This function should be called early to 121 - * wait on the ARM9. 122 - */ 123 - void proc_comm_boot_wait(void) 124 - { 125 - void __iomem *base = MSM_SHARED_RAM_BASE; 126 - 127 - proc_comm_wait_for(base + MDM_STATUS, PCOM_READY); 128 - 129 - }
-258
arch/arm/mach-msm/proc_comm.h
··· 1 - /* arch/arm/mach-msm/proc_comm.h 2 - * 3 - * Copyright (c) 2007 QUALCOMM Incorporated 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #ifndef _ARCH_ARM_MACH_MSM_PROC_COMM_H_ 17 - #define _ARCH_ARM_MACH_MSM_PROC_COMM_H_ 18 - 19 - #include <linux/init.h> 20 - 21 - enum { 22 - PCOM_CMD_IDLE = 0x0, 23 - PCOM_CMD_DONE, 24 - PCOM_RESET_APPS, 25 - PCOM_RESET_CHIP, 26 - PCOM_CONFIG_NAND_MPU, 27 - PCOM_CONFIG_USB_CLKS, 28 - PCOM_GET_POWER_ON_STATUS, 29 - PCOM_GET_WAKE_UP_STATUS, 30 - PCOM_GET_BATT_LEVEL, 31 - PCOM_CHG_IS_CHARGING, 32 - PCOM_POWER_DOWN, 33 - PCOM_USB_PIN_CONFIG, 34 - PCOM_USB_PIN_SEL, 35 - PCOM_SET_RTC_ALARM, 36 - PCOM_NV_READ, 37 - PCOM_NV_WRITE, 38 - PCOM_GET_UUID_HIGH, 39 - PCOM_GET_UUID_LOW, 40 - PCOM_GET_HW_ENTROPY, 41 - PCOM_RPC_GPIO_TLMM_CONFIG_REMOTE, 42 - PCOM_CLKCTL_RPC_ENABLE, 43 - PCOM_CLKCTL_RPC_DISABLE, 44 - PCOM_CLKCTL_RPC_RESET, 45 - PCOM_CLKCTL_RPC_SET_FLAGS, 46 - PCOM_CLKCTL_RPC_SET_RATE, 47 - PCOM_CLKCTL_RPC_MIN_RATE, 48 - PCOM_CLKCTL_RPC_MAX_RATE, 49 - PCOM_CLKCTL_RPC_RATE, 50 - PCOM_CLKCTL_RPC_PLL_REQUEST, 51 - PCOM_CLKCTL_RPC_ENABLED, 52 - PCOM_VREG_SWITCH, 53 - PCOM_VREG_SET_LEVEL, 54 - PCOM_GPIO_TLMM_CONFIG_GROUP, 55 - PCOM_GPIO_TLMM_UNCONFIG_GROUP, 56 - PCOM_NV_WRITE_BYTES_4_7, 57 - PCOM_CONFIG_DISP, 58 - PCOM_GET_FTM_BOOT_COUNT, 59 - PCOM_RPC_GPIO_TLMM_CONFIG_EX, 60 - PCOM_PM_MPP_CONFIG, 61 - PCOM_GPIO_IN, 62 - PCOM_GPIO_OUT, 63 - PCOM_RESET_MODEM, 64 - PCOM_RESET_CHIP_IMM, 65 - PCOM_PM_VID_EN, 66 - PCOM_VREG_PULLDOWN, 67 - PCOM_GET_MODEM_VERSION, 68 - PCOM_CLK_REGIME_SEC_RESET, 69 - PCOM_CLK_REGIME_SEC_RESET_ASSERT, 70 - PCOM_CLK_REGIME_SEC_RESET_DEASSERT, 71 - PCOM_CLK_REGIME_SEC_PLL_REQUEST_WRP, 72 - PCOM_CLK_REGIME_SEC_ENABLE, 73 - PCOM_CLK_REGIME_SEC_DISABLE, 74 - PCOM_CLK_REGIME_SEC_IS_ON, 75 - PCOM_CLK_REGIME_SEC_SEL_CLK_INV, 76 - PCOM_CLK_REGIME_SEC_SEL_CLK_SRC, 77 - PCOM_CLK_REGIME_SEC_SEL_CLK_DIV, 78 - PCOM_CLK_REGIME_SEC_ICODEC_CLK_ENABLE, 79 - PCOM_CLK_REGIME_SEC_ICODEC_CLK_DISABLE, 80 - PCOM_CLK_REGIME_SEC_SEL_SPEED, 81 - PCOM_CLK_REGIME_SEC_CONFIG_GP_CLK_WRP, 82 - PCOM_CLK_REGIME_SEC_CONFIG_MDH_CLK_WRP, 83 - PCOM_CLK_REGIME_SEC_USB_XTAL_ON, 84 - PCOM_CLK_REGIME_SEC_USB_XTAL_OFF, 85 - PCOM_CLK_REGIME_SEC_SET_QDSP_DME_MODE, 86 - PCOM_CLK_REGIME_SEC_SWITCH_ADSP_CLK, 87 - PCOM_CLK_REGIME_SEC_GET_MAX_ADSP_CLK_KHZ, 88 - PCOM_CLK_REGIME_SEC_GET_I2C_CLK_KHZ, 89 - PCOM_CLK_REGIME_SEC_MSM_GET_CLK_FREQ_KHZ, 90 - PCOM_CLK_REGIME_SEC_SEL_VFE_SRC, 91 - PCOM_CLK_REGIME_SEC_MSM_SEL_CAMCLK, 92 - PCOM_CLK_REGIME_SEC_MSM_SEL_LCDCLK, 93 - PCOM_CLK_REGIME_SEC_VFE_RAIL_OFF, 94 - PCOM_CLK_REGIME_SEC_VFE_RAIL_ON, 95 - PCOM_CLK_REGIME_SEC_GRP_RAIL_OFF, 96 - PCOM_CLK_REGIME_SEC_GRP_RAIL_ON, 97 - PCOM_CLK_REGIME_SEC_VDC_RAIL_OFF, 98 - PCOM_CLK_REGIME_SEC_VDC_RAIL_ON, 99 - PCOM_CLK_REGIME_SEC_LCD_CTRL, 100 - PCOM_CLK_REGIME_SEC_REGISTER_FOR_CPU_RESOURCE, 101 - PCOM_CLK_REGIME_SEC_DEREGISTER_FOR_CPU_RESOURCE, 102 - PCOM_CLK_REGIME_SEC_RESOURCE_REQUEST_WRP, 103 - PCOM_CLK_REGIME_MSM_SEC_SEL_CLK_OWNER, 104 - PCOM_CLK_REGIME_SEC_DEVMAN_REQUEST_WRP, 105 - PCOM_GPIO_CONFIG, 106 - PCOM_GPIO_CONFIGURE_GROUP, 107 - PCOM_GPIO_TLMM_SET_PORT, 108 - PCOM_GPIO_TLMM_CONFIG_EX, 109 - PCOM_SET_FTM_BOOT_COUNT, 110 - PCOM_RESERVED0, 111 - PCOM_RESERVED1, 112 - PCOM_CUSTOMER_CMD1, 113 - PCOM_CUSTOMER_CMD2, 114 - PCOM_CUSTOMER_CMD3, 115 - PCOM_CLK_REGIME_ENTER_APPSBL_CHG_MODE, 116 - PCOM_CLK_REGIME_EXIT_APPSBL_CHG_MODE, 117 - PCOM_CLK_REGIME_SEC_RAIL_DISABLE, 118 - PCOM_CLK_REGIME_SEC_RAIL_ENABLE, 119 - PCOM_CLK_REGIME_SEC_RAIL_CONTROL, 120 - PCOM_SET_SW_WATCHDOG_STATE, 121 - PCOM_PM_MPP_CONFIG_DIGITAL_INPUT, 122 - PCOM_PM_MPP_CONFIG_I_SINK, 123 - PCOM_RESERVED_101, 124 - PCOM_MSM_HSUSB_PHY_RESET, 125 - PCOM_GET_BATT_MV_LEVEL, 126 - PCOM_CHG_USB_IS_PC_CONNECTED, 127 - PCOM_CHG_USB_IS_CHARGER_CONNECTED, 128 - PCOM_CHG_USB_IS_DISCONNECTED, 129 - PCOM_CHG_USB_IS_AVAILABLE, 130 - PCOM_CLK_REGIME_SEC_MSM_SEL_FREQ, 131 - PCOM_CLK_REGIME_SEC_SET_PCLK_AXI_POLICY, 132 - PCOM_CLKCTL_RPC_RESET_ASSERT, 133 - PCOM_CLKCTL_RPC_RESET_DEASSERT, 134 - PCOM_CLKCTL_RPC_RAIL_ON, 135 - PCOM_CLKCTL_RPC_RAIL_OFF, 136 - PCOM_CLKCTL_RPC_RAIL_ENABLE, 137 - PCOM_CLKCTL_RPC_RAIL_DISABLE, 138 - PCOM_CLKCTL_RPC_RAIL_CONTROL, 139 - PCOM_CLKCTL_RPC_MIN_MSMC1, 140 - PCOM_NUM_CMDS, 141 - }; 142 - 143 - enum { 144 - PCOM_INVALID_STATUS = 0x0, 145 - PCOM_READY, 146 - PCOM_CMD_RUNNING, 147 - PCOM_CMD_SUCCESS, 148 - PCOM_CMD_FAIL, 149 - PCOM_CMD_FAIL_FALSE_RETURNED, 150 - PCOM_CMD_FAIL_CMD_OUT_OF_BOUNDS_SERVER, 151 - PCOM_CMD_FAIL_CMD_OUT_OF_BOUNDS_CLIENT, 152 - PCOM_CMD_FAIL_CMD_UNREGISTERED, 153 - PCOM_CMD_FAIL_CMD_LOCKED, 154 - PCOM_CMD_FAIL_SERVER_NOT_YET_READY, 155 - PCOM_CMD_FAIL_BAD_DESTINATION, 156 - PCOM_CMD_FAIL_SERVER_RESET, 157 - PCOM_CMD_FAIL_SMSM_NOT_INIT, 158 - PCOM_CMD_FAIL_PROC_COMM_BUSY, 159 - PCOM_CMD_FAIL_PROC_COMM_NOT_INIT, 160 - 161 - }; 162 - 163 - /* List of VREGs that support the Pull Down Resistor setting. */ 164 - enum vreg_pdown_id { 165 - PM_VREG_PDOWN_MSMA_ID, 166 - PM_VREG_PDOWN_MSMP_ID, 167 - PM_VREG_PDOWN_MSME1_ID, /* Not supported in Panoramix */ 168 - PM_VREG_PDOWN_MSMC1_ID, /* Not supported in PM6620 */ 169 - PM_VREG_PDOWN_MSMC2_ID, /* Supported in PM7500 only */ 170 - PM_VREG_PDOWN_GP3_ID, /* Supported in PM7500 only */ 171 - PM_VREG_PDOWN_MSME2_ID, /* Supported in PM7500 and Panoramix only */ 172 - PM_VREG_PDOWN_GP4_ID, /* Supported in PM7500 only */ 173 - PM_VREG_PDOWN_GP1_ID, /* Supported in PM7500 only */ 174 - PM_VREG_PDOWN_TCXO_ID, 175 - PM_VREG_PDOWN_PA_ID, 176 - PM_VREG_PDOWN_RFTX_ID, 177 - PM_VREG_PDOWN_RFRX1_ID, 178 - PM_VREG_PDOWN_RFRX2_ID, 179 - PM_VREG_PDOWN_SYNT_ID, 180 - PM_VREG_PDOWN_WLAN_ID, 181 - PM_VREG_PDOWN_USB_ID, 182 - PM_VREG_PDOWN_MMC_ID, 183 - PM_VREG_PDOWN_RUIM_ID, 184 - PM_VREG_PDOWN_MSMC0_ID, /* Supported in PM6610 only */ 185 - PM_VREG_PDOWN_GP2_ID, /* Supported in PM7500 only */ 186 - PM_VREG_PDOWN_GP5_ID, /* Supported in PM7500 only */ 187 - PM_VREG_PDOWN_GP6_ID, /* Supported in PM7500 only */ 188 - PM_VREG_PDOWN_RF_ID, 189 - PM_VREG_PDOWN_RF_VCO_ID, 190 - PM_VREG_PDOWN_MPLL_ID, 191 - PM_VREG_PDOWN_S2_ID, 192 - PM_VREG_PDOWN_S3_ID, 193 - PM_VREG_PDOWN_RFUBM_ID, 194 - 195 - /* new for HAN */ 196 - PM_VREG_PDOWN_RF1_ID, 197 - PM_VREG_PDOWN_RF2_ID, 198 - PM_VREG_PDOWN_RFA_ID, 199 - PM_VREG_PDOWN_CDC2_ID, 200 - PM_VREG_PDOWN_RFTX2_ID, 201 - PM_VREG_PDOWN_USIM_ID, 202 - PM_VREG_PDOWN_USB2P6_ID, 203 - PM_VREG_PDOWN_USB3P3_ID, 204 - PM_VREG_PDOWN_INVALID_ID, 205 - 206 - /* backward compatible enums only */ 207 - PM_VREG_PDOWN_CAM_ID = PM_VREG_PDOWN_GP1_ID, 208 - PM_VREG_PDOWN_MDDI_ID = PM_VREG_PDOWN_GP2_ID, 209 - PM_VREG_PDOWN_RUIM2_ID = PM_VREG_PDOWN_GP3_ID, 210 - PM_VREG_PDOWN_AUX_ID = PM_VREG_PDOWN_GP4_ID, 211 - PM_VREG_PDOWN_AUX2_ID = PM_VREG_PDOWN_GP5_ID, 212 - PM_VREG_PDOWN_BT_ID = PM_VREG_PDOWN_GP6_ID, 213 - 214 - PM_VREG_PDOWN_MSME_ID = PM_VREG_PDOWN_MSME1_ID, 215 - PM_VREG_PDOWN_MSMC_ID = PM_VREG_PDOWN_MSMC1_ID, 216 - PM_VREG_PDOWN_RFA1_ID = PM_VREG_PDOWN_RFRX2_ID, 217 - PM_VREG_PDOWN_RFA2_ID = PM_VREG_PDOWN_RFTX2_ID, 218 - PM_VREG_PDOWN_XO_ID = PM_VREG_PDOWN_TCXO_ID 219 - }; 220 - 221 - enum { 222 - PCOM_CLKRGM_APPS_RESET_USB_PHY = 34, 223 - PCOM_CLKRGM_APPS_RESET_USBH = 37, 224 - }; 225 - 226 - /* gpio info for PCOM_RPC_GPIO_TLMM_CONFIG_EX */ 227 - 228 - #define GPIO_ENABLE 0 229 - #define GPIO_DISABLE 1 230 - 231 - #define GPIO_INPUT 0 232 - #define GPIO_OUTPUT 1 233 - 234 - #define GPIO_NO_PULL 0 235 - #define GPIO_PULL_DOWN 1 236 - #define GPIO_KEEPER 2 237 - #define GPIO_PULL_UP 3 238 - 239 - #define GPIO_2MA 0 240 - #define GPIO_4MA 1 241 - #define GPIO_6MA 2 242 - #define GPIO_8MA 3 243 - #define GPIO_10MA 4 244 - #define GPIO_12MA 5 245 - #define GPIO_14MA 6 246 - #define GPIO_16MA 7 247 - 248 - #define PCOM_GPIO_CFG(gpio, func, dir, pull, drvstr) \ 249 - ((((gpio) & 0x3FF) << 4) | \ 250 - ((func) & 0xf) | \ 251 - (((dir) & 0x1) << 14) | \ 252 - (((pull) & 0x3) << 15) | \ 253 - (((drvstr) & 0xF) << 17)) 254 - 255 - int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2); 256 - void proc_comm_boot_wait(void); 257 - 258 - #endif
-172
arch/arm/mach-msm/sirc.c
··· 1 - /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 - * 02110-1301, USA. 16 - * 17 - */ 18 - 19 - #include <linux/io.h> 20 - #include <linux/irq.h> 21 - #include <linux/interrupt.h> 22 - #include <asm/irq.h> 23 - 24 - static unsigned int int_enable; 25 - static unsigned int wake_enable; 26 - 27 - static struct sirc_regs_t sirc_regs = { 28 - .int_enable = SPSS_SIRC_INT_ENABLE, 29 - .int_enable_clear = SPSS_SIRC_INT_ENABLE_CLEAR, 30 - .int_enable_set = SPSS_SIRC_INT_ENABLE_SET, 31 - .int_type = SPSS_SIRC_INT_TYPE, 32 - .int_polarity = SPSS_SIRC_INT_POLARITY, 33 - .int_clear = SPSS_SIRC_INT_CLEAR, 34 - }; 35 - 36 - static struct sirc_cascade_regs sirc_reg_table[] = { 37 - { 38 - .int_status = SPSS_SIRC_IRQ_STATUS, 39 - .cascade_irq = INT_SIRC_0, 40 - } 41 - }; 42 - 43 - /* Mask off the given interrupt. Keep the int_enable mask in sync with 44 - the enable reg, so it can be restored after power collapse. */ 45 - static void sirc_irq_mask(struct irq_data *d) 46 - { 47 - unsigned int mask; 48 - 49 - mask = 1 << (d->irq - FIRST_SIRC_IRQ); 50 - writel(mask, sirc_regs.int_enable_clear); 51 - int_enable &= ~mask; 52 - return; 53 - } 54 - 55 - /* Unmask the given interrupt. Keep the int_enable mask in sync with 56 - the enable reg, so it can be restored after power collapse. */ 57 - static void sirc_irq_unmask(struct irq_data *d) 58 - { 59 - unsigned int mask; 60 - 61 - mask = 1 << (d->irq - FIRST_SIRC_IRQ); 62 - writel(mask, sirc_regs.int_enable_set); 63 - int_enable |= mask; 64 - return; 65 - } 66 - 67 - static void sirc_irq_ack(struct irq_data *d) 68 - { 69 - unsigned int mask; 70 - 71 - mask = 1 << (d->irq - FIRST_SIRC_IRQ); 72 - writel(mask, sirc_regs.int_clear); 73 - return; 74 - } 75 - 76 - static int sirc_irq_set_wake(struct irq_data *d, unsigned int on) 77 - { 78 - unsigned int mask; 79 - 80 - /* Used to set the interrupt enable mask during power collapse. */ 81 - mask = 1 << (d->irq - FIRST_SIRC_IRQ); 82 - if (on) 83 - wake_enable |= mask; 84 - else 85 - wake_enable &= ~mask; 86 - 87 - return 0; 88 - } 89 - 90 - static int sirc_irq_set_type(struct irq_data *d, unsigned int flow_type) 91 - { 92 - unsigned int mask; 93 - unsigned int val; 94 - 95 - mask = 1 << (d->irq - FIRST_SIRC_IRQ); 96 - val = readl(sirc_regs.int_polarity); 97 - 98 - if (flow_type & (IRQF_TRIGGER_LOW | IRQF_TRIGGER_FALLING)) 99 - val |= mask; 100 - else 101 - val &= ~mask; 102 - 103 - writel(val, sirc_regs.int_polarity); 104 - 105 - val = readl(sirc_regs.int_type); 106 - if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { 107 - val |= mask; 108 - __irq_set_handler_locked(d->irq, handle_edge_irq); 109 - } else { 110 - val &= ~mask; 111 - __irq_set_handler_locked(d->irq, handle_level_irq); 112 - } 113 - 114 - writel(val, sirc_regs.int_type); 115 - 116 - return 0; 117 - } 118 - 119 - /* Finds the pending interrupt on the passed cascade irq and redrives it */ 120 - static void sirc_irq_handler(unsigned int irq, struct irq_desc *desc) 121 - { 122 - unsigned int reg = 0; 123 - unsigned int sirq; 124 - unsigned int status; 125 - 126 - while ((reg < ARRAY_SIZE(sirc_reg_table)) && 127 - (sirc_reg_table[reg].cascade_irq != irq)) 128 - reg++; 129 - 130 - status = readl(sirc_reg_table[reg].int_status); 131 - status &= SIRC_MASK; 132 - if (status == 0) 133 - return; 134 - 135 - for (sirq = 0; 136 - (sirq < NR_SIRC_IRQS) && ((status & (1U << sirq)) == 0); 137 - sirq++) 138 - ; 139 - generic_handle_irq(sirq+FIRST_SIRC_IRQ); 140 - 141 - desc->irq_data.chip->irq_ack(&desc->irq_data); 142 - } 143 - 144 - static struct irq_chip sirc_irq_chip = { 145 - .name = "sirc", 146 - .irq_ack = sirc_irq_ack, 147 - .irq_mask = sirc_irq_mask, 148 - .irq_unmask = sirc_irq_unmask, 149 - .irq_set_wake = sirc_irq_set_wake, 150 - .irq_set_type = sirc_irq_set_type, 151 - }; 152 - 153 - void __init msm_init_sirc(void) 154 - { 155 - int i; 156 - 157 - int_enable = 0; 158 - wake_enable = 0; 159 - 160 - for (i = FIRST_SIRC_IRQ; i < LAST_SIRC_IRQ; i++) { 161 - irq_set_chip_and_handler(i, &sirc_irq_chip, handle_edge_irq); 162 - set_irq_flags(i, IRQF_VALID); 163 - } 164 - 165 - for (i = 0; i < ARRAY_SIZE(sirc_reg_table); i++) { 166 - irq_set_chained_handler(sirc_reg_table[i].cascade_irq, 167 - sirc_irq_handler); 168 - irq_set_irq_wake(sirc_reg_table[i].cascade_irq, 1); 169 - } 170 - return; 171 - } 172 -
-1034
arch/arm/mach-msm/smd.c
··· 1 - /* arch/arm/mach-msm/smd.c 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - 17 - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 18 - 19 - #include <linux/platform_device.h> 20 - #include <linux/module.h> 21 - #include <linux/fs.h> 22 - #include <linux/cdev.h> 23 - #include <linux/device.h> 24 - #include <linux/wait.h> 25 - #include <linux/interrupt.h> 26 - #include <linux/irq.h> 27 - #include <linux/list.h> 28 - #include <linux/slab.h> 29 - #include <linux/debugfs.h> 30 - #include <linux/delay.h> 31 - 32 - #include <mach/msm_smd.h> 33 - 34 - #include "smd_private.h" 35 - #include "proc_comm.h" 36 - 37 - #if defined(CONFIG_ARCH_QSD8X50) 38 - #define CONFIG_QDSP6 1 39 - #endif 40 - 41 - #define MODULE_NAME "msm_smd" 42 - 43 - enum { 44 - MSM_SMD_DEBUG = 1U << 0, 45 - MSM_SMSM_DEBUG = 1U << 0, 46 - }; 47 - 48 - static int msm_smd_debug_mask; 49 - 50 - struct shared_info { 51 - int ready; 52 - void __iomem *state; 53 - }; 54 - 55 - static unsigned dummy_state[SMSM_STATE_COUNT]; 56 - 57 - static struct shared_info smd_info = { 58 - /* FIXME: not a real __iomem pointer */ 59 - .state = &dummy_state, 60 - }; 61 - 62 - module_param_named(debug_mask, msm_smd_debug_mask, 63 - int, S_IRUGO | S_IWUSR | S_IWGRP); 64 - 65 - static unsigned last_heap_free = 0xffffffff; 66 - 67 - static inline void notify_other_smsm(void) 68 - { 69 - msm_a2m_int(5); 70 - #ifdef CONFIG_QDSP6 71 - msm_a2m_int(8); 72 - #endif 73 - } 74 - 75 - static inline void notify_modem_smd(void) 76 - { 77 - msm_a2m_int(0); 78 - } 79 - 80 - static inline void notify_dsp_smd(void) 81 - { 82 - msm_a2m_int(8); 83 - } 84 - 85 - static void smd_diag(void) 86 - { 87 - char *x; 88 - 89 - x = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG); 90 - if (x != 0) { 91 - x[SZ_DIAG_ERR_MSG - 1] = 0; 92 - pr_debug("DIAG '%s'\n", x); 93 - } 94 - } 95 - 96 - /* call when SMSM_RESET flag is set in the A9's smsm_state */ 97 - static void handle_modem_crash(void) 98 - { 99 - pr_err("ARM9 has CRASHED\n"); 100 - smd_diag(); 101 - 102 - /* in this case the modem or watchdog should reboot us */ 103 - for (;;) 104 - ; 105 - } 106 - 107 - uint32_t raw_smsm_get_state(enum smsm_state_item item) 108 - { 109 - return readl(smd_info.state + item * 4); 110 - } 111 - 112 - static int check_for_modem_crash(void) 113 - { 114 - if (raw_smsm_get_state(SMSM_STATE_MODEM) & SMSM_RESET) { 115 - handle_modem_crash(); 116 - return -1; 117 - } 118 - return 0; 119 - } 120 - 121 - /* the spinlock is used to synchronize between the 122 - * irq handler and code that mutates the channel 123 - * list or fiddles with channel state 124 - */ 125 - DEFINE_SPINLOCK(smd_lock); 126 - DEFINE_SPINLOCK(smem_lock); 127 - 128 - /* the mutex is used during open() and close() 129 - * operations to avoid races while creating or 130 - * destroying smd_channel structures 131 - */ 132 - static DEFINE_MUTEX(smd_creation_mutex); 133 - 134 - static int smd_initialized; 135 - 136 - LIST_HEAD(smd_ch_closed_list); 137 - LIST_HEAD(smd_ch_list_modem); 138 - LIST_HEAD(smd_ch_list_dsp); 139 - 140 - static unsigned char smd_ch_allocated[64]; 141 - static struct work_struct probe_work; 142 - 143 - /* how many bytes are available for reading */ 144 - static int smd_stream_read_avail(struct smd_channel *ch) 145 - { 146 - return (ch->recv->head - ch->recv->tail) & ch->fifo_mask; 147 - } 148 - 149 - /* how many bytes we are free to write */ 150 - static int smd_stream_write_avail(struct smd_channel *ch) 151 - { 152 - return ch->fifo_mask - 153 - ((ch->send->head - ch->send->tail) & ch->fifo_mask); 154 - } 155 - 156 - static int smd_packet_read_avail(struct smd_channel *ch) 157 - { 158 - if (ch->current_packet) { 159 - int n = smd_stream_read_avail(ch); 160 - if (n > ch->current_packet) 161 - n = ch->current_packet; 162 - return n; 163 - } else { 164 - return 0; 165 - } 166 - } 167 - 168 - static int smd_packet_write_avail(struct smd_channel *ch) 169 - { 170 - int n = smd_stream_write_avail(ch); 171 - return n > SMD_HEADER_SIZE ? n - SMD_HEADER_SIZE : 0; 172 - } 173 - 174 - static int ch_is_open(struct smd_channel *ch) 175 - { 176 - return (ch->recv->state == SMD_SS_OPENED) && 177 - (ch->send->state == SMD_SS_OPENED); 178 - } 179 - 180 - /* provide a pointer and length to readable data in the fifo */ 181 - static unsigned ch_read_buffer(struct smd_channel *ch, void **ptr) 182 - { 183 - unsigned head = ch->recv->head; 184 - unsigned tail = ch->recv->tail; 185 - *ptr = (void *) (ch->recv_data + tail); 186 - 187 - if (tail <= head) 188 - return head - tail; 189 - else 190 - return ch->fifo_size - tail; 191 - } 192 - 193 - /* advance the fifo read pointer after data from ch_read_buffer is consumed */ 194 - static void ch_read_done(struct smd_channel *ch, unsigned count) 195 - { 196 - BUG_ON(count > smd_stream_read_avail(ch)); 197 - ch->recv->tail = (ch->recv->tail + count) & ch->fifo_mask; 198 - ch->send->fTAIL = 1; 199 - } 200 - 201 - /* basic read interface to ch_read_{buffer,done} used 202 - * by smd_*_read() and update_packet_state() 203 - * will read-and-discard if the _data pointer is null 204 - */ 205 - static int ch_read(struct smd_channel *ch, void *_data, int len) 206 - { 207 - void *ptr; 208 - unsigned n; 209 - unsigned char *data = _data; 210 - int orig_len = len; 211 - 212 - while (len > 0) { 213 - n = ch_read_buffer(ch, &ptr); 214 - if (n == 0) 215 - break; 216 - 217 - if (n > len) 218 - n = len; 219 - if (_data) 220 - memcpy(data, ptr, n); 221 - 222 - data += n; 223 - len -= n; 224 - ch_read_done(ch, n); 225 - } 226 - 227 - return orig_len - len; 228 - } 229 - 230 - static void update_stream_state(struct smd_channel *ch) 231 - { 232 - /* streams have no special state requiring updating */ 233 - } 234 - 235 - static void update_packet_state(struct smd_channel *ch) 236 - { 237 - unsigned hdr[5]; 238 - int r; 239 - 240 - /* can't do anything if we're in the middle of a packet */ 241 - if (ch->current_packet != 0) 242 - return; 243 - 244 - /* don't bother unless we can get the full header */ 245 - if (smd_stream_read_avail(ch) < SMD_HEADER_SIZE) 246 - return; 247 - 248 - r = ch_read(ch, hdr, SMD_HEADER_SIZE); 249 - BUG_ON(r != SMD_HEADER_SIZE); 250 - 251 - ch->current_packet = hdr[0]; 252 - } 253 - 254 - /* provide a pointer and length to next free space in the fifo */ 255 - static unsigned ch_write_buffer(struct smd_channel *ch, void **ptr) 256 - { 257 - unsigned head = ch->send->head; 258 - unsigned tail = ch->send->tail; 259 - *ptr = (void *) (ch->send_data + head); 260 - 261 - if (head < tail) { 262 - return tail - head - 1; 263 - } else { 264 - if (tail == 0) 265 - return ch->fifo_size - head - 1; 266 - else 267 - return ch->fifo_size - head; 268 - } 269 - } 270 - 271 - /* advace the fifo write pointer after freespace 272 - * from ch_write_buffer is filled 273 - */ 274 - static void ch_write_done(struct smd_channel *ch, unsigned count) 275 - { 276 - BUG_ON(count > smd_stream_write_avail(ch)); 277 - ch->send->head = (ch->send->head + count) & ch->fifo_mask; 278 - ch->send->fHEAD = 1; 279 - } 280 - 281 - static void ch_set_state(struct smd_channel *ch, unsigned n) 282 - { 283 - if (n == SMD_SS_OPENED) { 284 - ch->send->fDSR = 1; 285 - ch->send->fCTS = 1; 286 - ch->send->fCD = 1; 287 - } else { 288 - ch->send->fDSR = 0; 289 - ch->send->fCTS = 0; 290 - ch->send->fCD = 0; 291 - } 292 - ch->send->state = n; 293 - ch->send->fSTATE = 1; 294 - ch->notify_other_cpu(); 295 - } 296 - 297 - static void do_smd_probe(void) 298 - { 299 - struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE; 300 - if (shared->heap_info.free_offset != last_heap_free) { 301 - last_heap_free = shared->heap_info.free_offset; 302 - schedule_work(&probe_work); 303 - } 304 - } 305 - 306 - static void smd_state_change(struct smd_channel *ch, 307 - unsigned last, unsigned next) 308 - { 309 - ch->last_state = next; 310 - 311 - pr_debug("ch %d %d -> %d\n", ch->n, last, next); 312 - 313 - switch (next) { 314 - case SMD_SS_OPENING: 315 - ch->recv->tail = 0; 316 - case SMD_SS_OPENED: 317 - if (ch->send->state != SMD_SS_OPENED) 318 - ch_set_state(ch, SMD_SS_OPENED); 319 - ch->notify(ch->priv, SMD_EVENT_OPEN); 320 - break; 321 - case SMD_SS_FLUSHING: 322 - case SMD_SS_RESET: 323 - /* we should force them to close? */ 324 - default: 325 - ch->notify(ch->priv, SMD_EVENT_CLOSE); 326 - } 327 - } 328 - 329 - static void handle_smd_irq(struct list_head *list, void (*notify)(void)) 330 - { 331 - unsigned long flags; 332 - struct smd_channel *ch; 333 - int do_notify = 0; 334 - unsigned ch_flags; 335 - unsigned tmp; 336 - 337 - spin_lock_irqsave(&smd_lock, flags); 338 - list_for_each_entry(ch, list, ch_list) { 339 - ch_flags = 0; 340 - if (ch_is_open(ch)) { 341 - if (ch->recv->fHEAD) { 342 - ch->recv->fHEAD = 0; 343 - ch_flags |= 1; 344 - do_notify |= 1; 345 - } 346 - if (ch->recv->fTAIL) { 347 - ch->recv->fTAIL = 0; 348 - ch_flags |= 2; 349 - do_notify |= 1; 350 - } 351 - if (ch->recv->fSTATE) { 352 - ch->recv->fSTATE = 0; 353 - ch_flags |= 4; 354 - do_notify |= 1; 355 - } 356 - } 357 - tmp = ch->recv->state; 358 - if (tmp != ch->last_state) 359 - smd_state_change(ch, ch->last_state, tmp); 360 - if (ch_flags) { 361 - ch->update_state(ch); 362 - ch->notify(ch->priv, SMD_EVENT_DATA); 363 - } 364 - } 365 - if (do_notify) 366 - notify(); 367 - spin_unlock_irqrestore(&smd_lock, flags); 368 - do_smd_probe(); 369 - } 370 - 371 - static irqreturn_t smd_modem_irq_handler(int irq, void *data) 372 - { 373 - handle_smd_irq(&smd_ch_list_modem, notify_modem_smd); 374 - return IRQ_HANDLED; 375 - } 376 - 377 - #if defined(CONFIG_QDSP6) 378 - static irqreturn_t smd_dsp_irq_handler(int irq, void *data) 379 - { 380 - handle_smd_irq(&smd_ch_list_dsp, notify_dsp_smd); 381 - return IRQ_HANDLED; 382 - } 383 - #endif 384 - 385 - static void smd_fake_irq_handler(unsigned long arg) 386 - { 387 - handle_smd_irq(&smd_ch_list_modem, notify_modem_smd); 388 - handle_smd_irq(&smd_ch_list_dsp, notify_dsp_smd); 389 - } 390 - 391 - static DECLARE_TASKLET(smd_fake_irq_tasklet, smd_fake_irq_handler, 0); 392 - 393 - static inline int smd_need_int(struct smd_channel *ch) 394 - { 395 - if (ch_is_open(ch)) { 396 - if (ch->recv->fHEAD || ch->recv->fTAIL || ch->recv->fSTATE) 397 - return 1; 398 - if (ch->recv->state != ch->last_state) 399 - return 1; 400 - } 401 - return 0; 402 - } 403 - 404 - void smd_sleep_exit(void) 405 - { 406 - unsigned long flags; 407 - struct smd_channel *ch; 408 - int need_int = 0; 409 - 410 - spin_lock_irqsave(&smd_lock, flags); 411 - list_for_each_entry(ch, &smd_ch_list_modem, ch_list) { 412 - if (smd_need_int(ch)) { 413 - need_int = 1; 414 - break; 415 - } 416 - } 417 - list_for_each_entry(ch, &smd_ch_list_dsp, ch_list) { 418 - if (smd_need_int(ch)) { 419 - need_int = 1; 420 - break; 421 - } 422 - } 423 - spin_unlock_irqrestore(&smd_lock, flags); 424 - do_smd_probe(); 425 - 426 - if (need_int) { 427 - if (msm_smd_debug_mask & MSM_SMD_DEBUG) 428 - pr_info("smd_sleep_exit need interrupt\n"); 429 - tasklet_schedule(&smd_fake_irq_tasklet); 430 - } 431 - } 432 - 433 - 434 - void smd_kick(smd_channel_t *ch) 435 - { 436 - unsigned long flags; 437 - unsigned tmp; 438 - 439 - spin_lock_irqsave(&smd_lock, flags); 440 - ch->update_state(ch); 441 - tmp = ch->recv->state; 442 - if (tmp != ch->last_state) { 443 - ch->last_state = tmp; 444 - if (tmp == SMD_SS_OPENED) 445 - ch->notify(ch->priv, SMD_EVENT_OPEN); 446 - else 447 - ch->notify(ch->priv, SMD_EVENT_CLOSE); 448 - } 449 - ch->notify(ch->priv, SMD_EVENT_DATA); 450 - ch->notify_other_cpu(); 451 - spin_unlock_irqrestore(&smd_lock, flags); 452 - } 453 - 454 - static int smd_is_packet(int chn, unsigned type) 455 - { 456 - type &= SMD_KIND_MASK; 457 - if (type == SMD_KIND_PACKET) 458 - return 1; 459 - if (type == SMD_KIND_STREAM) 460 - return 0; 461 - 462 - /* older AMSS reports SMD_KIND_UNKNOWN always */ 463 - if ((chn > 4) || (chn == 1)) 464 - return 1; 465 - else 466 - return 0; 467 - } 468 - 469 - static int smd_stream_write(smd_channel_t *ch, const void *_data, int len) 470 - { 471 - void *ptr; 472 - const unsigned char *buf = _data; 473 - unsigned xfer; 474 - int orig_len = len; 475 - 476 - if (len < 0) 477 - return -EINVAL; 478 - 479 - while ((xfer = ch_write_buffer(ch, &ptr)) != 0) { 480 - if (!ch_is_open(ch)) 481 - break; 482 - if (xfer > len) 483 - xfer = len; 484 - memcpy(ptr, buf, xfer); 485 - ch_write_done(ch, xfer); 486 - len -= xfer; 487 - buf += xfer; 488 - if (len == 0) 489 - break; 490 - } 491 - 492 - ch->notify_other_cpu(); 493 - 494 - return orig_len - len; 495 - } 496 - 497 - static int smd_packet_write(smd_channel_t *ch, const void *_data, int len) 498 - { 499 - unsigned hdr[5]; 500 - 501 - if (len < 0) 502 - return -EINVAL; 503 - 504 - if (smd_stream_write_avail(ch) < (len + SMD_HEADER_SIZE)) 505 - return -ENOMEM; 506 - 507 - hdr[0] = len; 508 - hdr[1] = hdr[2] = hdr[3] = hdr[4] = 0; 509 - 510 - smd_stream_write(ch, hdr, sizeof(hdr)); 511 - smd_stream_write(ch, _data, len); 512 - 513 - return len; 514 - } 515 - 516 - static int smd_stream_read(smd_channel_t *ch, void *data, int len) 517 - { 518 - int r; 519 - 520 - if (len < 0) 521 - return -EINVAL; 522 - 523 - r = ch_read(ch, data, len); 524 - if (r > 0) 525 - ch->notify_other_cpu(); 526 - 527 - return r; 528 - } 529 - 530 - static int smd_packet_read(smd_channel_t *ch, void *data, int len) 531 - { 532 - unsigned long flags; 533 - int r; 534 - 535 - if (len < 0) 536 - return -EINVAL; 537 - 538 - if (len > ch->current_packet) 539 - len = ch->current_packet; 540 - 541 - r = ch_read(ch, data, len); 542 - if (r > 0) 543 - ch->notify_other_cpu(); 544 - 545 - spin_lock_irqsave(&smd_lock, flags); 546 - ch->current_packet -= r; 547 - update_packet_state(ch); 548 - spin_unlock_irqrestore(&smd_lock, flags); 549 - 550 - return r; 551 - } 552 - 553 - static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type) 554 - { 555 - struct smd_channel *ch; 556 - 557 - ch = kzalloc(sizeof(struct smd_channel), GFP_KERNEL); 558 - if (ch == 0) { 559 - pr_err("smd_alloc_channel() out of memory\n"); 560 - return -1; 561 - } 562 - ch->n = cid; 563 - 564 - if (_smd_alloc_channel(ch)) { 565 - kfree(ch); 566 - return -1; 567 - } 568 - 569 - ch->fifo_mask = ch->fifo_size - 1; 570 - ch->type = type; 571 - 572 - if ((type & SMD_TYPE_MASK) == SMD_TYPE_APPS_MODEM) 573 - ch->notify_other_cpu = notify_modem_smd; 574 - else 575 - ch->notify_other_cpu = notify_dsp_smd; 576 - 577 - if (smd_is_packet(cid, type)) { 578 - ch->read = smd_packet_read; 579 - ch->write = smd_packet_write; 580 - ch->read_avail = smd_packet_read_avail; 581 - ch->write_avail = smd_packet_write_avail; 582 - ch->update_state = update_packet_state; 583 - } else { 584 - ch->read = smd_stream_read; 585 - ch->write = smd_stream_write; 586 - ch->read_avail = smd_stream_read_avail; 587 - ch->write_avail = smd_stream_write_avail; 588 - ch->update_state = update_stream_state; 589 - } 590 - 591 - if ((type & 0xff) == 0) 592 - memcpy(ch->name, "SMD_", 4); 593 - else 594 - memcpy(ch->name, "DSP_", 4); 595 - memcpy(ch->name + 4, name, 20); 596 - ch->name[23] = 0; 597 - ch->pdev.name = ch->name; 598 - ch->pdev.id = -1; 599 - 600 - pr_debug("smd_alloc_channel() cid=%02d size=%05d '%s'\n", 601 - ch->n, ch->fifo_size, ch->name); 602 - 603 - mutex_lock(&smd_creation_mutex); 604 - list_add(&ch->ch_list, &smd_ch_closed_list); 605 - mutex_unlock(&smd_creation_mutex); 606 - 607 - platform_device_register(&ch->pdev); 608 - return 0; 609 - } 610 - 611 - static void smd_channel_probe_worker(struct work_struct *work) 612 - { 613 - struct smd_alloc_elm *shared; 614 - unsigned ctype; 615 - unsigned type; 616 - unsigned n; 617 - 618 - shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64); 619 - if (!shared) { 620 - pr_err("cannot find allocation table\n"); 621 - return; 622 - } 623 - for (n = 0; n < 64; n++) { 624 - if (smd_ch_allocated[n]) 625 - continue; 626 - if (!shared[n].ref_count) 627 - continue; 628 - if (!shared[n].name[0]) 629 - continue; 630 - ctype = shared[n].ctype; 631 - type = ctype & SMD_TYPE_MASK; 632 - 633 - /* DAL channels are stream but neither the modem, 634 - * nor the DSP correctly indicate this. Fixup manually. 635 - */ 636 - if (!memcmp(shared[n].name, "DAL", 3)) 637 - ctype = (ctype & (~SMD_KIND_MASK)) | SMD_KIND_STREAM; 638 - 639 - type = shared[n].ctype & SMD_TYPE_MASK; 640 - if ((type == SMD_TYPE_APPS_MODEM) || 641 - (type == SMD_TYPE_APPS_DSP)) 642 - if (!smd_alloc_channel(shared[n].name, shared[n].cid, ctype)) 643 - smd_ch_allocated[n] = 1; 644 - } 645 - } 646 - 647 - static void do_nothing_notify(void *priv, unsigned flags) 648 - { 649 - } 650 - 651 - struct smd_channel *smd_get_channel(const char *name) 652 - { 653 - struct smd_channel *ch; 654 - 655 - mutex_lock(&smd_creation_mutex); 656 - list_for_each_entry(ch, &smd_ch_closed_list, ch_list) { 657 - if (!strcmp(name, ch->name)) { 658 - list_del(&ch->ch_list); 659 - mutex_unlock(&smd_creation_mutex); 660 - return ch; 661 - } 662 - } 663 - mutex_unlock(&smd_creation_mutex); 664 - 665 - return NULL; 666 - } 667 - 668 - int smd_open(const char *name, smd_channel_t **_ch, 669 - void *priv, void (*notify)(void *, unsigned)) 670 - { 671 - struct smd_channel *ch; 672 - unsigned long flags; 673 - 674 - if (smd_initialized == 0) { 675 - pr_info("smd_open() before smd_init()\n"); 676 - return -ENODEV; 677 - } 678 - 679 - ch = smd_get_channel(name); 680 - if (!ch) 681 - return -ENODEV; 682 - 683 - if (notify == 0) 684 - notify = do_nothing_notify; 685 - 686 - ch->notify = notify; 687 - ch->current_packet = 0; 688 - ch->last_state = SMD_SS_CLOSED; 689 - ch->priv = priv; 690 - 691 - *_ch = ch; 692 - 693 - spin_lock_irqsave(&smd_lock, flags); 694 - 695 - if ((ch->type & SMD_TYPE_MASK) == SMD_TYPE_APPS_MODEM) 696 - list_add(&ch->ch_list, &smd_ch_list_modem); 697 - else 698 - list_add(&ch->ch_list, &smd_ch_list_dsp); 699 - 700 - /* If the remote side is CLOSING, we need to get it to 701 - * move to OPENING (which we'll do by moving from CLOSED to 702 - * OPENING) and then get it to move from OPENING to 703 - * OPENED (by doing the same state change ourselves). 704 - * 705 - * Otherwise, it should be OPENING and we can move directly 706 - * to OPENED so that it will follow. 707 - */ 708 - if (ch->recv->state == SMD_SS_CLOSING) { 709 - ch->send->head = 0; 710 - ch_set_state(ch, SMD_SS_OPENING); 711 - } else { 712 - ch_set_state(ch, SMD_SS_OPENED); 713 - } 714 - spin_unlock_irqrestore(&smd_lock, flags); 715 - smd_kick(ch); 716 - 717 - return 0; 718 - } 719 - 720 - int smd_close(smd_channel_t *ch) 721 - { 722 - unsigned long flags; 723 - 724 - if (ch == 0) 725 - return -1; 726 - 727 - spin_lock_irqsave(&smd_lock, flags); 728 - ch->notify = do_nothing_notify; 729 - list_del(&ch->ch_list); 730 - ch_set_state(ch, SMD_SS_CLOSED); 731 - spin_unlock_irqrestore(&smd_lock, flags); 732 - 733 - mutex_lock(&smd_creation_mutex); 734 - list_add(&ch->ch_list, &smd_ch_closed_list); 735 - mutex_unlock(&smd_creation_mutex); 736 - 737 - return 0; 738 - } 739 - 740 - int smd_read(smd_channel_t *ch, void *data, int len) 741 - { 742 - return ch->read(ch, data, len); 743 - } 744 - 745 - int smd_write(smd_channel_t *ch, const void *data, int len) 746 - { 747 - return ch->write(ch, data, len); 748 - } 749 - 750 - int smd_write_atomic(smd_channel_t *ch, const void *data, int len) 751 - { 752 - unsigned long flags; 753 - int res; 754 - spin_lock_irqsave(&smd_lock, flags); 755 - res = ch->write(ch, data, len); 756 - spin_unlock_irqrestore(&smd_lock, flags); 757 - return res; 758 - } 759 - 760 - int smd_read_avail(smd_channel_t *ch) 761 - { 762 - return ch->read_avail(ch); 763 - } 764 - 765 - int smd_write_avail(smd_channel_t *ch) 766 - { 767 - return ch->write_avail(ch); 768 - } 769 - 770 - int smd_wait_until_readable(smd_channel_t *ch, int bytes) 771 - { 772 - return -1; 773 - } 774 - 775 - int smd_wait_until_writable(smd_channel_t *ch, int bytes) 776 - { 777 - return -1; 778 - } 779 - 780 - int smd_cur_packet_size(smd_channel_t *ch) 781 - { 782 - return ch->current_packet; 783 - } 784 - 785 - 786 - /* ------------------------------------------------------------------------- */ 787 - 788 - void *smem_alloc(unsigned id, unsigned size) 789 - { 790 - return smem_find(id, size); 791 - } 792 - 793 - void __iomem *smem_item(unsigned id, unsigned *size) 794 - { 795 - struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE; 796 - struct smem_heap_entry *toc = shared->heap_toc; 797 - 798 - if (id >= SMEM_NUM_ITEMS) 799 - return NULL; 800 - 801 - if (toc[id].allocated) { 802 - *size = toc[id].size; 803 - return (MSM_SHARED_RAM_BASE + toc[id].offset); 804 - } else { 805 - *size = 0; 806 - } 807 - 808 - return NULL; 809 - } 810 - 811 - void *smem_find(unsigned id, unsigned size_in) 812 - { 813 - unsigned size; 814 - void *ptr; 815 - 816 - ptr = smem_item(id, &size); 817 - if (!ptr) 818 - return 0; 819 - 820 - size_in = ALIGN(size_in, 8); 821 - if (size_in != size) { 822 - pr_err("smem_find(%d, %d): wrong size %d\n", 823 - id, size_in, size); 824 - return 0; 825 - } 826 - 827 - return ptr; 828 - } 829 - 830 - static irqreturn_t smsm_irq_handler(int irq, void *data) 831 - { 832 - unsigned long flags; 833 - unsigned apps, modm; 834 - 835 - spin_lock_irqsave(&smem_lock, flags); 836 - 837 - apps = raw_smsm_get_state(SMSM_STATE_APPS); 838 - modm = raw_smsm_get_state(SMSM_STATE_MODEM); 839 - 840 - if (msm_smd_debug_mask & MSM_SMSM_DEBUG) 841 - pr_info("<SM %08x %08x>\n", apps, modm); 842 - if (modm & SMSM_RESET) 843 - handle_modem_crash(); 844 - 845 - do_smd_probe(); 846 - 847 - spin_unlock_irqrestore(&smem_lock, flags); 848 - return IRQ_HANDLED; 849 - } 850 - 851 - int smsm_change_state(enum smsm_state_item item, 852 - uint32_t clear_mask, uint32_t set_mask) 853 - { 854 - void __iomem *addr = smd_info.state + item * 4; 855 - unsigned long flags; 856 - unsigned state; 857 - 858 - if (!smd_info.ready) 859 - return -EIO; 860 - 861 - spin_lock_irqsave(&smem_lock, flags); 862 - 863 - if (raw_smsm_get_state(SMSM_STATE_MODEM) & SMSM_RESET) 864 - handle_modem_crash(); 865 - 866 - state = (readl(addr) & ~clear_mask) | set_mask; 867 - writel(state, addr); 868 - 869 - if (msm_smd_debug_mask & MSM_SMSM_DEBUG) 870 - pr_info("smsm_change_state %d %x\n", item, state); 871 - notify_other_smsm(); 872 - 873 - spin_unlock_irqrestore(&smem_lock, flags); 874 - 875 - return 0; 876 - } 877 - 878 - uint32_t smsm_get_state(enum smsm_state_item item) 879 - { 880 - unsigned long flags; 881 - uint32_t rv; 882 - 883 - spin_lock_irqsave(&smem_lock, flags); 884 - 885 - rv = readl(smd_info.state + item * 4); 886 - 887 - if (item == SMSM_STATE_MODEM && (rv & SMSM_RESET)) 888 - handle_modem_crash(); 889 - 890 - spin_unlock_irqrestore(&smem_lock, flags); 891 - 892 - return rv; 893 - } 894 - 895 - #ifdef CONFIG_ARCH_MSM_SCORPION 896 - 897 - int smsm_set_sleep_duration(uint32_t delay) 898 - { 899 - struct msm_dem_slave_data *ptr; 900 - 901 - ptr = smem_find(SMEM_APPS_DEM_SLAVE_DATA, sizeof(*ptr)); 902 - if (ptr == NULL) { 903 - pr_err("smsm_set_sleep_duration <SM NO APPS_DEM_SLAVE_DATA>\n"); 904 - return -EIO; 905 - } 906 - if (msm_smd_debug_mask & MSM_SMSM_DEBUG) 907 - pr_info("smsm_set_sleep_duration %d -> %d\n", 908 - ptr->sleep_time, delay); 909 - ptr->sleep_time = delay; 910 - return 0; 911 - } 912 - 913 - #else 914 - 915 - int smsm_set_sleep_duration(uint32_t delay) 916 - { 917 - uint32_t *ptr; 918 - 919 - ptr = smem_find(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr)); 920 - if (ptr == NULL) { 921 - pr_err("smsm_set_sleep_duration <SM NO SLEEP_DELAY>\n"); 922 - return -EIO; 923 - } 924 - if (msm_smd_debug_mask & MSM_SMSM_DEBUG) 925 - pr_info("smsm_set_sleep_duration %d -> %d\n", 926 - *ptr, delay); 927 - *ptr = delay; 928 - return 0; 929 - } 930 - 931 - #endif 932 - 933 - int smd_core_init(void) 934 - { 935 - int r; 936 - 937 - /* wait for essential items to be initialized */ 938 - for (;;) { 939 - unsigned size; 940 - void __iomem *state; 941 - state = smem_item(SMEM_SMSM_SHARED_STATE, &size); 942 - if (size == SMSM_V1_SIZE || size == SMSM_V2_SIZE) { 943 - smd_info.state = state; 944 - break; 945 - } 946 - } 947 - 948 - smd_info.ready = 1; 949 - 950 - r = request_irq(INT_A9_M2A_0, smd_modem_irq_handler, 951 - IRQF_TRIGGER_RISING, "smd_dev", 0); 952 - if (r < 0) 953 - return r; 954 - r = enable_irq_wake(INT_A9_M2A_0); 955 - if (r < 0) 956 - pr_err("smd_core_init: enable_irq_wake failed for A9_M2A_0\n"); 957 - 958 - r = request_irq(INT_A9_M2A_5, smsm_irq_handler, 959 - IRQF_TRIGGER_RISING, "smsm_dev", 0); 960 - if (r < 0) { 961 - free_irq(INT_A9_M2A_0, 0); 962 - return r; 963 - } 964 - r = enable_irq_wake(INT_A9_M2A_5); 965 - if (r < 0) 966 - pr_err("smd_core_init: enable_irq_wake failed for A9_M2A_5\n"); 967 - 968 - #if defined(CONFIG_QDSP6) 969 - r = request_irq(INT_ADSP_A11, smd_dsp_irq_handler, 970 - IRQF_TRIGGER_RISING, "smd_dsp", 0); 971 - if (r < 0) { 972 - free_irq(INT_A9_M2A_0, 0); 973 - free_irq(INT_A9_M2A_5, 0); 974 - return r; 975 - } 976 - #endif 977 - 978 - /* check for any SMD channels that may already exist */ 979 - do_smd_probe(); 980 - 981 - /* indicate that we're up and running */ 982 - smsm_change_state(SMSM_STATE_APPS, 983 - ~0, SMSM_INIT | SMSM_SMDINIT | SMSM_RPCINIT | SMSM_RUN); 984 - #ifdef CONFIG_ARCH_MSM_SCORPION 985 - smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0); 986 - #endif 987 - 988 - return 0; 989 - } 990 - 991 - static int msm_smd_probe(struct platform_device *pdev) 992 - { 993 - /* 994 - * If we haven't waited for the ARM9 to boot up till now, 995 - * then we need to wait here. Otherwise this should just 996 - * return immediately. 997 - */ 998 - proc_comm_boot_wait(); 999 - 1000 - INIT_WORK(&probe_work, smd_channel_probe_worker); 1001 - 1002 - if (smd_core_init()) { 1003 - pr_err("smd_core_init() failed\n"); 1004 - return -1; 1005 - } 1006 - 1007 - do_smd_probe(); 1008 - 1009 - msm_check_for_modem_crash = check_for_modem_crash; 1010 - 1011 - msm_init_last_radio_log(THIS_MODULE); 1012 - 1013 - smd_initialized = 1; 1014 - 1015 - return 0; 1016 - } 1017 - 1018 - static struct platform_driver msm_smd_driver = { 1019 - .probe = msm_smd_probe, 1020 - .driver = { 1021 - .name = MODULE_NAME, 1022 - }, 1023 - }; 1024 - 1025 - static int __init msm_smd_init(void) 1026 - { 1027 - return platform_driver_register(&msm_smd_driver); 1028 - } 1029 - 1030 - module_init(msm_smd_init); 1031 - 1032 - MODULE_DESCRIPTION("MSM Shared Memory Core"); 1033 - MODULE_AUTHOR("Brian Swetland <swetland@google.com>"); 1034 - MODULE_LICENSE("GPL");
-311
arch/arm/mach-msm/smd_debug.c
··· 1 - /* arch/arm/mach-msm/smd_debug.c 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * Author: Brian Swetland <swetland@google.com> 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - 17 - #include <linux/debugfs.h> 18 - #include <linux/list.h> 19 - 20 - #include <mach/msm_iomap.h> 21 - 22 - #include "smd_private.h" 23 - 24 - #if defined(CONFIG_DEBUG_FS) 25 - 26 - static char *chstate(unsigned n) 27 - { 28 - switch (n) { 29 - case SMD_SS_CLOSED: 30 - return "CLOSED"; 31 - case SMD_SS_OPENING: 32 - return "OPENING"; 33 - case SMD_SS_OPENED: 34 - return "OPENED"; 35 - case SMD_SS_FLUSHING: 36 - return "FLUSHING"; 37 - case SMD_SS_CLOSING: 38 - return "CLOSING"; 39 - case SMD_SS_RESET: 40 - return "RESET"; 41 - case SMD_SS_RESET_OPENING: 42 - return "ROPENING"; 43 - default: 44 - return "UNKNOWN"; 45 - } 46 - } 47 - 48 - 49 - static int dump_ch(char *buf, int max, struct smd_channel *ch) 50 - { 51 - volatile struct smd_half_channel *s = ch->send; 52 - volatile struct smd_half_channel *r = ch->recv; 53 - 54 - return scnprintf( 55 - buf, max, 56 - "ch%02d:" 57 - " %8s(%05d/%05d) %c%c%c%c%c%c%c <->" 58 - " %8s(%05d/%05d) %c%c%c%c%c%c%c '%s'\n", ch->n, 59 - chstate(s->state), s->tail, s->head, 60 - s->fDSR ? 'D' : 'd', 61 - s->fCTS ? 'C' : 'c', 62 - s->fCD ? 'C' : 'c', 63 - s->fRI ? 'I' : 'i', 64 - s->fHEAD ? 'W' : 'w', 65 - s->fTAIL ? 'R' : 'r', 66 - s->fSTATE ? 'S' : 's', 67 - chstate(r->state), r->tail, r->head, 68 - r->fDSR ? 'D' : 'd', 69 - r->fCTS ? 'R' : 'r', 70 - r->fCD ? 'C' : 'c', 71 - r->fRI ? 'I' : 'i', 72 - r->fHEAD ? 'W' : 'w', 73 - r->fTAIL ? 'R' : 'r', 74 - r->fSTATE ? 'S' : 's', 75 - ch->name 76 - ); 77 - } 78 - 79 - static int debug_read_stat(char *buf, int max) 80 - { 81 - char *msg; 82 - int i = 0; 83 - 84 - msg = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG); 85 - 86 - if (raw_smsm_get_state(SMSM_STATE_MODEM) & SMSM_RESET) 87 - i += scnprintf(buf + i, max - i, 88 - "smsm: ARM9 HAS CRASHED\n"); 89 - 90 - i += scnprintf(buf + i, max - i, "smsm: a9: %08x a11: %08x\n", 91 - raw_smsm_get_state(SMSM_STATE_MODEM), 92 - raw_smsm_get_state(SMSM_STATE_APPS)); 93 - #ifdef CONFIG_ARCH_MSM_SCORPION 94 - i += scnprintf(buf + i, max - i, "smsm dem: apps: %08x modem: %08x " 95 - "qdsp6: %08x power: %08x time: %08x\n", 96 - raw_smsm_get_state(SMSM_STATE_APPS_DEM), 97 - raw_smsm_get_state(SMSM_STATE_MODEM_DEM), 98 - raw_smsm_get_state(SMSM_STATE_QDSP6_DEM), 99 - raw_smsm_get_state(SMSM_STATE_POWER_MASTER_DEM), 100 - raw_smsm_get_state(SMSM_STATE_TIME_MASTER_DEM)); 101 - #endif 102 - if (msg) { 103 - msg[SZ_DIAG_ERR_MSG - 1] = 0; 104 - i += scnprintf(buf + i, max - i, "diag: '%s'\n", msg); 105 - } 106 - return i; 107 - } 108 - 109 - static int debug_read_mem(char *buf, int max) 110 - { 111 - unsigned n; 112 - struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE; 113 - struct smem_heap_entry *toc = shared->heap_toc; 114 - int i = 0; 115 - 116 - i += scnprintf(buf + i, max - i, 117 - "heap: init=%d free=%d remain=%d\n", 118 - shared->heap_info.initialized, 119 - shared->heap_info.free_offset, 120 - shared->heap_info.heap_remaining); 121 - 122 - for (n = 0; n < SMEM_NUM_ITEMS; n++) { 123 - if (toc[n].allocated == 0) 124 - continue; 125 - i += scnprintf(buf + i, max - i, 126 - "%04d: offset %08x size %08x\n", 127 - n, toc[n].offset, toc[n].size); 128 - } 129 - return i; 130 - } 131 - 132 - static int debug_read_ch(char *buf, int max) 133 - { 134 - struct smd_channel *ch; 135 - unsigned long flags; 136 - int i = 0; 137 - 138 - spin_lock_irqsave(&smd_lock, flags); 139 - list_for_each_entry(ch, &smd_ch_list_dsp, ch_list) 140 - i += dump_ch(buf + i, max - i, ch); 141 - list_for_each_entry(ch, &smd_ch_list_modem, ch_list) 142 - i += dump_ch(buf + i, max - i, ch); 143 - list_for_each_entry(ch, &smd_ch_closed_list, ch_list) 144 - i += dump_ch(buf + i, max - i, ch); 145 - spin_unlock_irqrestore(&smd_lock, flags); 146 - 147 - return i; 148 - } 149 - 150 - static int debug_read_version(char *buf, int max) 151 - { 152 - struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE; 153 - unsigned version = shared->version[VERSION_MODEM]; 154 - return sprintf(buf, "%d.%d\n", version >> 16, version & 0xffff); 155 - } 156 - 157 - static int debug_read_build_id(char *buf, int max) 158 - { 159 - unsigned size; 160 - void *data; 161 - 162 - data = smem_item(SMEM_HW_SW_BUILD_ID, &size); 163 - if (!data) 164 - return 0; 165 - 166 - if (size >= max) 167 - size = max; 168 - memcpy(buf, data, size); 169 - 170 - return size; 171 - } 172 - 173 - static int debug_read_alloc_tbl(char *buf, int max) 174 - { 175 - struct smd_alloc_elm *shared; 176 - int n, i = 0; 177 - 178 - shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64); 179 - 180 - for (n = 0; n < 64; n++) { 181 - if (shared[n].ref_count == 0) 182 - continue; 183 - i += scnprintf(buf + i, max - i, 184 - "%03d: %-20s cid=%02d type=%03d " 185 - "kind=%02d ref_count=%d\n", 186 - n, shared[n].name, shared[n].cid, 187 - shared[n].ctype & 0xff, 188 - (shared[n].ctype >> 8) & 0xf, 189 - shared[n].ref_count); 190 - } 191 - 192 - return i; 193 - } 194 - 195 - #define DEBUG_BUFMAX 4096 196 - static char debug_buffer[DEBUG_BUFMAX]; 197 - 198 - static ssize_t debug_read(struct file *file, char __user *buf, 199 - size_t count, loff_t *ppos) 200 - { 201 - int (*fill)(char *buf, int max) = file->private_data; 202 - int bsize = fill(debug_buffer, DEBUG_BUFMAX); 203 - return simple_read_from_buffer(buf, count, ppos, debug_buffer, bsize); 204 - } 205 - 206 - static const struct file_operations debug_ops = { 207 - .read = debug_read, 208 - .open = simple_open, 209 - .llseek = default_llseek, 210 - }; 211 - 212 - static void debug_create(const char *name, umode_t mode, 213 - struct dentry *dent, 214 - int (*fill)(char *buf, int max)) 215 - { 216 - debugfs_create_file(name, mode, dent, fill, &debug_ops); 217 - } 218 - 219 - int __init smd_debugfs_init(void) 220 - { 221 - struct dentry *dent; 222 - 223 - dent = debugfs_create_dir("smd", 0); 224 - if (IS_ERR(dent)) 225 - return 1; 226 - 227 - debug_create("ch", 0444, dent, debug_read_ch); 228 - debug_create("stat", 0444, dent, debug_read_stat); 229 - debug_create("mem", 0444, dent, debug_read_mem); 230 - debug_create("version", 0444, dent, debug_read_version); 231 - debug_create("tbl", 0444, dent, debug_read_alloc_tbl); 232 - debug_create("build", 0444, dent, debug_read_build_id); 233 - 234 - return 0; 235 - } 236 - 237 - #endif 238 - 239 - 240 - #define MAX_NUM_SLEEP_CLIENTS 64 241 - #define MAX_SLEEP_NAME_LEN 8 242 - 243 - #define NUM_GPIO_INT_REGISTERS 6 244 - #define GPIO_SMEM_NUM_GROUPS 2 245 - #define GPIO_SMEM_MAX_PC_INTERRUPTS 8 246 - 247 - struct tramp_gpio_save { 248 - unsigned int enable; 249 - unsigned int detect; 250 - unsigned int polarity; 251 - }; 252 - 253 - struct tramp_gpio_smem { 254 - uint16_t num_fired[GPIO_SMEM_NUM_GROUPS]; 255 - uint16_t fired[GPIO_SMEM_NUM_GROUPS][GPIO_SMEM_MAX_PC_INTERRUPTS]; 256 - uint32_t enabled[NUM_GPIO_INT_REGISTERS]; 257 - uint32_t detection[NUM_GPIO_INT_REGISTERS]; 258 - uint32_t polarity[NUM_GPIO_INT_REGISTERS]; 259 - }; 260 - 261 - 262 - void smsm_print_sleep_info(void) 263 - { 264 - unsigned long flags; 265 - uint32_t *ptr; 266 - #ifndef CONFIG_ARCH_MSM_SCORPION 267 - struct tramp_gpio_smem *gpio; 268 - struct smsm_interrupt_info *int_info; 269 - #endif 270 - 271 - 272 - spin_lock_irqsave(&smem_lock, flags); 273 - 274 - ptr = smem_alloc(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr)); 275 - if (ptr) 276 - pr_info("SMEM_SMSM_SLEEP_DELAY: %x\n", *ptr); 277 - 278 - ptr = smem_alloc(SMEM_SMSM_LIMIT_SLEEP, sizeof(*ptr)); 279 - if (ptr) 280 - pr_info("SMEM_SMSM_LIMIT_SLEEP: %x\n", *ptr); 281 - 282 - ptr = smem_alloc(SMEM_SLEEP_POWER_COLLAPSE_DISABLED, sizeof(*ptr)); 283 - if (ptr) 284 - pr_info("SMEM_SLEEP_POWER_COLLAPSE_DISABLED: %x\n", *ptr); 285 - 286 - #ifndef CONFIG_ARCH_MSM_SCORPION 287 - int_info = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*int_info)); 288 - if (int_info) 289 - pr_info("SMEM_SMSM_INT_INFO %x %x %x\n", 290 - int_info->interrupt_mask, 291 - int_info->pending_interrupts, 292 - int_info->wakeup_reason); 293 - 294 - gpio = smem_alloc(SMEM_GPIO_INT, sizeof(*gpio)); 295 - if (gpio) { 296 - int i; 297 - for (i = 0; i < NUM_GPIO_INT_REGISTERS; i++) 298 - pr_info("SMEM_GPIO_INT: %d: e %x d %x p %x\n", 299 - i, gpio->enabled[i], gpio->detection[i], 300 - gpio->polarity[i]); 301 - 302 - for (i = 0; i < GPIO_SMEM_NUM_GROUPS; i++) 303 - pr_info("SMEM_GPIO_INT: %d: f %d: %d %d...\n", 304 - i, gpio->num_fired[i], gpio->fired[i][0], 305 - gpio->fired[i][1]); 306 - } 307 - #else 308 - #endif 309 - spin_unlock_irqrestore(&smem_lock, flags); 310 - } 311 -
-403
arch/arm/mach-msm/smd_private.h
··· 1 - /* arch/arm/mach-msm/smd_private.h 2 - * 3 - * Copyright (C) 2007 Google, Inc. 4 - * Copyright (c) 2007 QUALCOMM Incorporated 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - */ 16 - #ifndef _ARCH_ARM_MACH_MSM_MSM_SMD_PRIVATE_H_ 17 - #define _ARCH_ARM_MACH_MSM_MSM_SMD_PRIVATE_H_ 18 - 19 - #include <linux/platform_device.h> 20 - #include <linux/spinlock.h> 21 - #include <linux/list.h> 22 - #include <linux/io.h> 23 - 24 - #include <mach/msm_iomap.h> 25 - 26 - struct smem_heap_info { 27 - unsigned initialized; 28 - unsigned free_offset; 29 - unsigned heap_remaining; 30 - unsigned reserved; 31 - }; 32 - 33 - struct smem_heap_entry { 34 - unsigned allocated; 35 - unsigned offset; 36 - unsigned size; 37 - unsigned reserved; 38 - }; 39 - 40 - struct smem_proc_comm { 41 - unsigned command; 42 - unsigned status; 43 - unsigned data1; 44 - unsigned data2; 45 - }; 46 - 47 - #define PC_APPS 0 48 - #define PC_MODEM 1 49 - 50 - #define VERSION_SMD 0 51 - #define VERSION_QDSP6 4 52 - #define VERSION_APPS_SBL 6 53 - #define VERSION_MODEM_SBL 7 54 - #define VERSION_APPS 8 55 - #define VERSION_MODEM 9 56 - 57 - struct smem_shared { 58 - struct smem_proc_comm proc_comm[4]; 59 - unsigned version[32]; 60 - struct smem_heap_info heap_info; 61 - struct smem_heap_entry heap_toc[512]; 62 - }; 63 - 64 - #define SMSM_V1_SIZE (sizeof(unsigned) * 8) 65 - #define SMSM_V2_SIZE (sizeof(unsigned) * 4) 66 - 67 - #ifdef CONFIG_MSM_SMD_PKG3 68 - struct smsm_interrupt_info { 69 - uint32_t interrupt_mask; 70 - uint32_t pending_interrupts; 71 - uint32_t wakeup_reason; 72 - }; 73 - #else 74 - #define DEM_MAX_PORT_NAME_LEN (20) 75 - struct msm_dem_slave_data { 76 - uint32_t sleep_time; 77 - uint32_t interrupt_mask; 78 - uint32_t resources_used; 79 - uint32_t reserved1; 80 - 81 - uint32_t wakeup_reason; 82 - uint32_t pending_interrupts; 83 - uint32_t rpc_prog; 84 - uint32_t rpc_proc; 85 - char smd_port_name[DEM_MAX_PORT_NAME_LEN]; 86 - uint32_t reserved2; 87 - }; 88 - #endif 89 - 90 - #define SZ_DIAG_ERR_MSG 0xC8 91 - #define ID_DIAG_ERR_MSG SMEM_DIAG_ERR_MESSAGE 92 - #define ID_SMD_CHANNELS SMEM_SMD_BASE_ID 93 - #define ID_SHARED_STATE SMEM_SMSM_SHARED_STATE 94 - #define ID_CH_ALLOC_TBL SMEM_CHANNEL_ALLOC_TBL 95 - 96 - #define SMSM_INIT 0x00000001 97 - #define SMSM_SMDINIT 0x00000008 98 - #define SMSM_RPCINIT 0x00000020 99 - #define SMSM_RESET 0x00000040 100 - #define SMSM_RSA 0x00000080 101 - #define SMSM_RUN 0x00000100 102 - #define SMSM_PWRC 0x00000200 103 - #define SMSM_TIMEWAIT 0x00000400 104 - #define SMSM_TIMEINIT 0x00000800 105 - #define SMSM_PWRC_EARLY_EXIT 0x00001000 106 - #define SMSM_WFPI 0x00002000 107 - #define SMSM_SLEEP 0x00004000 108 - #define SMSM_SLEEPEXIT 0x00008000 109 - #define SMSM_APPS_REBOOT 0x00020000 110 - #define SMSM_SYSTEM_POWER_DOWN 0x00040000 111 - #define SMSM_SYSTEM_REBOOT 0x00080000 112 - #define SMSM_SYSTEM_DOWNLOAD 0x00100000 113 - #define SMSM_PWRC_SUSPEND 0x00200000 114 - #define SMSM_APPS_SHUTDOWN 0x00400000 115 - #define SMSM_SMD_LOOPBACK 0x00800000 116 - #define SMSM_RUN_QUIET 0x01000000 117 - #define SMSM_MODEM_WAIT 0x02000000 118 - #define SMSM_MODEM_BREAK 0x04000000 119 - #define SMSM_MODEM_CONTINUE 0x08000000 120 - #define SMSM_UNKNOWN 0x80000000 121 - 122 - #define SMSM_WKUP_REASON_RPC 0x00000001 123 - #define SMSM_WKUP_REASON_INT 0x00000002 124 - #define SMSM_WKUP_REASON_GPIO 0x00000004 125 - #define SMSM_WKUP_REASON_TIMER 0x00000008 126 - #define SMSM_WKUP_REASON_ALARM 0x00000010 127 - #define SMSM_WKUP_REASON_RESET 0x00000020 128 - 129 - #ifdef CONFIG_ARCH_MSM7X00A 130 - enum smsm_state_item { 131 - SMSM_STATE_APPS = 1, 132 - SMSM_STATE_MODEM = 3, 133 - SMSM_STATE_COUNT, 134 - }; 135 - #else 136 - enum smsm_state_item { 137 - SMSM_STATE_APPS, 138 - SMSM_STATE_MODEM, 139 - SMSM_STATE_HEXAGON, 140 - SMSM_STATE_APPS_DEM, 141 - SMSM_STATE_MODEM_DEM, 142 - SMSM_STATE_QDSP6_DEM, 143 - SMSM_STATE_POWER_MASTER_DEM, 144 - SMSM_STATE_TIME_MASTER_DEM, 145 - SMSM_STATE_COUNT, 146 - }; 147 - #endif 148 - 149 - void *smem_alloc(unsigned id, unsigned size); 150 - int smsm_change_state(enum smsm_state_item item, uint32_t clear_mask, uint32_t set_mask); 151 - uint32_t smsm_get_state(enum smsm_state_item item); 152 - int smsm_set_sleep_duration(uint32_t delay); 153 - void smsm_print_sleep_info(void); 154 - 155 - #define SMEM_NUM_SMD_CHANNELS 64 156 - 157 - typedef enum { 158 - /* fixed items */ 159 - SMEM_PROC_COMM = 0, 160 - SMEM_HEAP_INFO, 161 - SMEM_ALLOCATION_TABLE, 162 - SMEM_VERSION_INFO, 163 - SMEM_HW_RESET_DETECT, 164 - SMEM_AARM_WARM_BOOT, 165 - SMEM_DIAG_ERR_MESSAGE, 166 - SMEM_SPINLOCK_ARRAY, 167 - SMEM_MEMORY_BARRIER_LOCATION, 168 - 169 - /* dynamic items */ 170 - SMEM_AARM_PARTITION_TABLE, 171 - SMEM_AARM_BAD_BLOCK_TABLE, 172 - SMEM_RESERVE_BAD_BLOCKS, 173 - SMEM_WM_UUID, 174 - SMEM_CHANNEL_ALLOC_TBL, 175 - SMEM_SMD_BASE_ID, 176 - SMEM_SMEM_LOG_IDX = SMEM_SMD_BASE_ID + SMEM_NUM_SMD_CHANNELS, 177 - SMEM_SMEM_LOG_EVENTS, 178 - SMEM_SMEM_STATIC_LOG_IDX, 179 - SMEM_SMEM_STATIC_LOG_EVENTS, 180 - SMEM_SMEM_SLOW_CLOCK_SYNC, 181 - SMEM_SMEM_SLOW_CLOCK_VALUE, 182 - SMEM_BIO_LED_BUF, 183 - SMEM_SMSM_SHARED_STATE, 184 - SMEM_SMSM_INT_INFO, 185 - SMEM_SMSM_SLEEP_DELAY, 186 - SMEM_SMSM_LIMIT_SLEEP, 187 - SMEM_SLEEP_POWER_COLLAPSE_DISABLED, 188 - SMEM_KEYPAD_KEYS_PRESSED, 189 - SMEM_KEYPAD_STATE_UPDATED, 190 - SMEM_KEYPAD_STATE_IDX, 191 - SMEM_GPIO_INT, 192 - SMEM_MDDI_LCD_IDX, 193 - SMEM_MDDI_HOST_DRIVER_STATE, 194 - SMEM_MDDI_LCD_DISP_STATE, 195 - SMEM_LCD_CUR_PANEL, 196 - SMEM_MARM_BOOT_SEGMENT_INFO, 197 - SMEM_AARM_BOOT_SEGMENT_INFO, 198 - SMEM_SLEEP_STATIC, 199 - SMEM_SCORPION_FREQUENCY, 200 - SMEM_SMD_PROFILES, 201 - SMEM_TSSC_BUSY, 202 - SMEM_HS_SUSPEND_FILTER_INFO, 203 - SMEM_BATT_INFO, 204 - SMEM_APPS_BOOT_MODE, 205 - SMEM_VERSION_FIRST, 206 - SMEM_VERSION_LAST = SMEM_VERSION_FIRST + 24, 207 - SMEM_OSS_RRCASN1_BUF1, 208 - SMEM_OSS_RRCASN1_BUF2, 209 - SMEM_ID_VENDOR0, 210 - SMEM_ID_VENDOR1, 211 - SMEM_ID_VENDOR2, 212 - SMEM_HW_SW_BUILD_ID, 213 - SMEM_SMD_BLOCK_PORT_BASE_ID, 214 - SMEM_SMD_BLOCK_PORT_PROC0_HEAP = SMEM_SMD_BLOCK_PORT_BASE_ID + SMEM_NUM_SMD_CHANNELS, 215 - SMEM_SMD_BLOCK_PORT_PROC1_HEAP = SMEM_SMD_BLOCK_PORT_PROC0_HEAP + SMEM_NUM_SMD_CHANNELS, 216 - SMEM_I2C_MUTEX = SMEM_SMD_BLOCK_PORT_PROC1_HEAP + SMEM_NUM_SMD_CHANNELS, 217 - SMEM_SCLK_CONVERSION, 218 - SMEM_SMD_SMSM_INTR_MUX, 219 - SMEM_SMSM_CPU_INTR_MASK, 220 - SMEM_APPS_DEM_SLAVE_DATA, 221 - SMEM_QDSP6_DEM_SLAVE_DATA, 222 - SMEM_CLKREGIM_BSP, 223 - SMEM_CLKREGIM_SOURCES, 224 - SMEM_SMD_FIFO_BASE_ID, 225 - SMEM_USABLE_RAM_PARTITION_TABLE = SMEM_SMD_FIFO_BASE_ID + SMEM_NUM_SMD_CHANNELS, 226 - SMEM_POWER_ON_STATUS_INFO, 227 - SMEM_DAL_AREA, 228 - SMEM_SMEM_LOG_POWER_IDX, 229 - SMEM_SMEM_LOG_POWER_WRAP, 230 - SMEM_SMEM_LOG_POWER_EVENTS, 231 - SMEM_ERR_CRASH_LOG, 232 - SMEM_ERR_F3_TRACE_LOG, 233 - SMEM_NUM_ITEMS, 234 - } smem_mem_type; 235 - 236 - 237 - #define SMD_SS_CLOSED 0x00000000 238 - #define SMD_SS_OPENING 0x00000001 239 - #define SMD_SS_OPENED 0x00000002 240 - #define SMD_SS_FLUSHING 0x00000003 241 - #define SMD_SS_CLOSING 0x00000004 242 - #define SMD_SS_RESET 0x00000005 243 - #define SMD_SS_RESET_OPENING 0x00000006 244 - 245 - #define SMD_BUF_SIZE 8192 246 - #define SMD_CHANNELS 64 247 - 248 - #define SMD_HEADER_SIZE 20 249 - 250 - struct smd_alloc_elm { 251 - char name[20]; 252 - uint32_t cid; 253 - uint32_t ctype; 254 - uint32_t ref_count; 255 - }; 256 - 257 - struct smd_half_channel { 258 - unsigned state; 259 - unsigned char fDSR; 260 - unsigned char fCTS; 261 - unsigned char fCD; 262 - unsigned char fRI; 263 - unsigned char fHEAD; 264 - unsigned char fTAIL; 265 - unsigned char fSTATE; 266 - unsigned char fUNUSED; 267 - unsigned tail; 268 - unsigned head; 269 - } __attribute__(( aligned(4), packed )); 270 - 271 - /* Only used on SMD package v3 on msm7201a */ 272 - struct smd_shared_v1 { 273 - struct smd_half_channel ch0; 274 - unsigned char data0[SMD_BUF_SIZE]; 275 - struct smd_half_channel ch1; 276 - unsigned char data1[SMD_BUF_SIZE]; 277 - }; 278 - 279 - /* Used on SMD package v4 */ 280 - struct smd_shared_v2 { 281 - struct smd_half_channel ch0; 282 - struct smd_half_channel ch1; 283 - }; 284 - 285 - struct smd_channel { 286 - volatile struct smd_half_channel *send; 287 - volatile struct smd_half_channel *recv; 288 - unsigned char *send_data; 289 - unsigned char *recv_data; 290 - 291 - unsigned fifo_mask; 292 - unsigned fifo_size; 293 - unsigned current_packet; 294 - unsigned n; 295 - 296 - struct list_head ch_list; 297 - 298 - void *priv; 299 - void (*notify)(void *priv, unsigned flags); 300 - 301 - int (*read)(struct smd_channel *ch, void *data, int len); 302 - int (*write)(struct smd_channel *ch, const void *data, int len); 303 - int (*read_avail)(struct smd_channel *ch); 304 - int (*write_avail)(struct smd_channel *ch); 305 - 306 - void (*update_state)(struct smd_channel *ch); 307 - unsigned last_state; 308 - void (*notify_other_cpu)(void); 309 - unsigned type; 310 - 311 - char name[32]; 312 - struct platform_device pdev; 313 - }; 314 - 315 - #define SMD_TYPE_MASK 0x0FF 316 - #define SMD_TYPE_APPS_MODEM 0x000 317 - #define SMD_TYPE_APPS_DSP 0x001 318 - #define SMD_TYPE_MODEM_DSP 0x002 319 - 320 - #define SMD_KIND_MASK 0xF00 321 - #define SMD_KIND_UNKNOWN 0x000 322 - #define SMD_KIND_STREAM 0x100 323 - #define SMD_KIND_PACKET 0x200 324 - 325 - extern struct list_head smd_ch_closed_list; 326 - extern struct list_head smd_ch_list_modem; 327 - extern struct list_head smd_ch_list_dsp; 328 - 329 - extern spinlock_t smd_lock; 330 - extern spinlock_t smem_lock; 331 - 332 - void *smem_find(unsigned id, unsigned size); 333 - void *smem_item(unsigned id, unsigned *size); 334 - uint32_t raw_smsm_get_state(enum smsm_state_item item); 335 - 336 - extern void msm_init_last_radio_log(struct module *); 337 - 338 - #ifdef CONFIG_MSM_SMD_PKG3 339 - /* 340 - * This allocator assumes an SMD Package v3 which only exists on 341 - * MSM7x00 SoC's. 342 - */ 343 - static inline int _smd_alloc_channel(struct smd_channel *ch) 344 - { 345 - struct smd_shared_v1 *shared1; 346 - 347 - shared1 = smem_alloc(ID_SMD_CHANNELS + ch->n, sizeof(*shared1)); 348 - if (!shared1) { 349 - pr_err("smd_alloc_channel() cid %d does not exist\n", ch->n); 350 - return -1; 351 - } 352 - ch->send = &shared1->ch0; 353 - ch->recv = &shared1->ch1; 354 - ch->send_data = shared1->data0; 355 - ch->recv_data = shared1->data1; 356 - ch->fifo_size = SMD_BUF_SIZE; 357 - return 0; 358 - } 359 - #else 360 - /* 361 - * This allocator assumes an SMD Package v4, the most common 362 - * and the default. 363 - */ 364 - static inline int _smd_alloc_channel(struct smd_channel *ch) 365 - { 366 - struct smd_shared_v2 *shared2; 367 - void *buffer; 368 - unsigned buffer_sz; 369 - 370 - shared2 = smem_alloc(SMEM_SMD_BASE_ID + ch->n, sizeof(*shared2)); 371 - buffer = smem_item(SMEM_SMD_FIFO_BASE_ID + ch->n, &buffer_sz); 372 - 373 - if (!buffer) 374 - return -1; 375 - 376 - /* buffer must be a power-of-two size */ 377 - if (buffer_sz & (buffer_sz - 1)) 378 - return -1; 379 - 380 - buffer_sz /= 2; 381 - ch->send = &shared2->ch0; 382 - ch->recv = &shared2->ch1; 383 - ch->send_data = buffer; 384 - ch->recv_data = buffer + buffer_sz; 385 - ch->fifo_size = buffer_sz; 386 - return 0; 387 - } 388 - #endif /* CONFIG_MSM_SMD_PKG3 */ 389 - 390 - #if defined(CONFIG_ARCH_MSM7X30) 391 - static inline void msm_a2m_int(uint32_t irq) 392 - { 393 - writel(1 << irq, MSM_GCC_BASE + 0x8); 394 - } 395 - #else 396 - static inline void msm_a2m_int(uint32_t irq) 397 - { 398 - writel(1, MSM_CSR_BASE + 0x400 + (irq * 4)); 399 - } 400 - #endif /* CONFIG_ARCH_MSM7X30 */ 401 - 402 - 403 - #endif
-220
arch/arm/mach-msm/vreg.c
··· 1 - /* arch/arm/mach-msm/vreg.c 2 - * 3 - * Copyright (C) 2008 Google, Inc. 4 - * Copyright (c) 2009, Code Aurora Forum. All rights reserved. 5 - * Author: Brian Swetland <swetland@google.com> 6 - * 7 - * This software is licensed under the terms of the GNU General Public 8 - * License version 2, as published by the Free Software Foundation, and 9 - * may be copied, distributed, and modified under those terms. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - */ 17 - 18 - #include <linux/kernel.h> 19 - #include <linux/device.h> 20 - #include <linux/init.h> 21 - #include <linux/debugfs.h> 22 - #include <linux/module.h> 23 - #include <linux/string.h> 24 - #include <mach/vreg.h> 25 - 26 - #include "proc_comm.h" 27 - 28 - struct vreg { 29 - const char *name; 30 - unsigned id; 31 - int status; 32 - unsigned refcnt; 33 - }; 34 - 35 - #define VREG(_name, _id, _status, _refcnt) \ 36 - { .name = _name, .id = _id, .status = _status, .refcnt = _refcnt } 37 - 38 - static struct vreg vregs[] = { 39 - VREG("msma", 0, 0, 0), 40 - VREG("msmp", 1, 0, 0), 41 - VREG("msme1", 2, 0, 0), 42 - VREG("msmc1", 3, 0, 0), 43 - VREG("msmc2", 4, 0, 0), 44 - VREG("gp3", 5, 0, 0), 45 - VREG("msme2", 6, 0, 0), 46 - VREG("gp4", 7, 0, 0), 47 - VREG("gp1", 8, 0, 0), 48 - VREG("tcxo", 9, 0, 0), 49 - VREG("pa", 10, 0, 0), 50 - VREG("rftx", 11, 0, 0), 51 - VREG("rfrx1", 12, 0, 0), 52 - VREG("rfrx2", 13, 0, 0), 53 - VREG("synt", 14, 0, 0), 54 - VREG("wlan", 15, 0, 0), 55 - VREG("usb", 16, 0, 0), 56 - VREG("boost", 17, 0, 0), 57 - VREG("mmc", 18, 0, 0), 58 - VREG("ruim", 19, 0, 0), 59 - VREG("msmc0", 20, 0, 0), 60 - VREG("gp2", 21, 0, 0), 61 - VREG("gp5", 22, 0, 0), 62 - VREG("gp6", 23, 0, 0), 63 - VREG("rf", 24, 0, 0), 64 - VREG("rf_vco", 26, 0, 0), 65 - VREG("mpll", 27, 0, 0), 66 - VREG("s2", 28, 0, 0), 67 - VREG("s3", 29, 0, 0), 68 - VREG("rfubm", 30, 0, 0), 69 - VREG("ncp", 31, 0, 0), 70 - VREG("gp7", 32, 0, 0), 71 - VREG("gp8", 33, 0, 0), 72 - VREG("gp9", 34, 0, 0), 73 - VREG("gp10", 35, 0, 0), 74 - VREG("gp11", 36, 0, 0), 75 - VREG("gp12", 37, 0, 0), 76 - VREG("gp13", 38, 0, 0), 77 - VREG("gp14", 39, 0, 0), 78 - VREG("gp15", 40, 0, 0), 79 - VREG("gp16", 41, 0, 0), 80 - VREG("gp17", 42, 0, 0), 81 - VREG("s4", 43, 0, 0), 82 - VREG("usb2", 44, 0, 0), 83 - VREG("wlan2", 45, 0, 0), 84 - VREG("xo_out", 46, 0, 0), 85 - VREG("lvsw0", 47, 0, 0), 86 - VREG("lvsw1", 48, 0, 0), 87 - }; 88 - 89 - struct vreg *vreg_get(struct device *dev, const char *id) 90 - { 91 - int n; 92 - for (n = 0; n < ARRAY_SIZE(vregs); n++) { 93 - if (!strcmp(vregs[n].name, id)) 94 - return vregs + n; 95 - } 96 - return ERR_PTR(-ENOENT); 97 - } 98 - 99 - void vreg_put(struct vreg *vreg) 100 - { 101 - } 102 - 103 - int vreg_enable(struct vreg *vreg) 104 - { 105 - unsigned id = vreg->id; 106 - unsigned enable = 1; 107 - 108 - if (vreg->refcnt == 0) 109 - vreg->status = msm_proc_comm(PCOM_VREG_SWITCH, &id, &enable); 110 - 111 - if ((vreg->refcnt < UINT_MAX) && (!vreg->status)) 112 - vreg->refcnt++; 113 - 114 - return vreg->status; 115 - } 116 - 117 - int vreg_disable(struct vreg *vreg) 118 - { 119 - unsigned id = vreg->id; 120 - unsigned enable = 0; 121 - 122 - if (!vreg->refcnt) 123 - return 0; 124 - 125 - if (vreg->refcnt == 1) 126 - vreg->status = msm_proc_comm(PCOM_VREG_SWITCH, &id, &enable); 127 - 128 - if (!vreg->status) 129 - vreg->refcnt--; 130 - 131 - return vreg->status; 132 - } 133 - 134 - int vreg_set_level(struct vreg *vreg, unsigned mv) 135 - { 136 - unsigned id = vreg->id; 137 - 138 - vreg->status = msm_proc_comm(PCOM_VREG_SET_LEVEL, &id, &mv); 139 - return vreg->status; 140 - } 141 - 142 - #if defined(CONFIG_DEBUG_FS) 143 - 144 - static int vreg_debug_set(void *data, u64 val) 145 - { 146 - struct vreg *vreg = data; 147 - switch (val) { 148 - case 0: 149 - vreg_disable(vreg); 150 - break; 151 - case 1: 152 - vreg_enable(vreg); 153 - break; 154 - default: 155 - vreg_set_level(vreg, val); 156 - break; 157 - } 158 - return 0; 159 - } 160 - 161 - static int vreg_debug_get(void *data, u64 *val) 162 - { 163 - struct vreg *vreg = data; 164 - 165 - if (!vreg->status) 166 - *val = 0; 167 - else 168 - *val = 1; 169 - 170 - return 0; 171 - } 172 - 173 - static int vreg_debug_count_set(void *data, u64 val) 174 - { 175 - struct vreg *vreg = data; 176 - if (val > UINT_MAX) 177 - val = UINT_MAX; 178 - vreg->refcnt = val; 179 - return 0; 180 - } 181 - 182 - static int vreg_debug_count_get(void *data, u64 *val) 183 - { 184 - struct vreg *vreg = data; 185 - 186 - *val = vreg->refcnt; 187 - 188 - return 0; 189 - } 190 - 191 - DEFINE_SIMPLE_ATTRIBUTE(vreg_fops, vreg_debug_get, vreg_debug_set, "%llu\n"); 192 - DEFINE_SIMPLE_ATTRIBUTE(vreg_count_fops, vreg_debug_count_get, 193 - vreg_debug_count_set, "%llu\n"); 194 - 195 - static int __init vreg_debug_init(void) 196 - { 197 - struct dentry *dent; 198 - int n; 199 - char name[32]; 200 - const char *refcnt_name = "_refcnt"; 201 - 202 - dent = debugfs_create_dir("vreg", 0); 203 - if (IS_ERR(dent)) 204 - return 0; 205 - 206 - for (n = 0; n < ARRAY_SIZE(vregs); n++) { 207 - (void) debugfs_create_file(vregs[n].name, 0644, 208 - dent, vregs + n, &vreg_fops); 209 - 210 - strlcpy(name, vregs[n].name, sizeof(name)); 211 - strlcat(name, refcnt_name, sizeof(name)); 212 - (void) debugfs_create_file(name, 0644, 213 - dent, vregs + n, &vreg_count_fops); 214 - } 215 - 216 - return 0; 217 - } 218 - 219 - device_initcall(vreg_debug_init); 220 - #endif
+3 -3
arch/arm/mach-mvebu/board-v7.c
··· 184 184 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 185 185 } 186 186 187 - static const char * const armada_370_xp_dt_compat[] = { 187 + static const char * const armada_370_xp_dt_compat[] __initconst = { 188 188 "marvell,armada-370-xp", 189 189 NULL, 190 190 }; ··· 205 205 .dt_compat = armada_370_xp_dt_compat, 206 206 MACHINE_END 207 207 208 - static const char * const armada_375_dt_compat[] = { 208 + static const char * const armada_375_dt_compat[] __initconst = { 209 209 "marvell,armada375", 210 210 NULL, 211 211 }; ··· 219 219 .dt_compat = armada_375_dt_compat, 220 220 MACHINE_END 221 221 222 - static const char * const armada_38x_dt_compat[] = { 222 + static const char * const armada_38x_dt_compat[] __initconst = { 223 223 "marvell,armada380", 224 224 "marvell,armada385", 225 225 NULL,
+1 -1
arch/arm/mach-mvebu/dove.c
··· 27 27 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 28 28 } 29 29 30 - static const char * const dove_dt_compat[] = { 30 + static const char * const dove_dt_compat[] __initconst = { 31 31 "marvell,dove", 32 32 NULL 33 33 };
+1 -1
arch/arm/mach-mvebu/kirkwood.c
··· 186 186 of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL); 187 187 } 188 188 189 - static const char * const kirkwood_dt_board_compat[] = { 189 + static const char * const kirkwood_dt_board_compat[] __initconst = { 190 190 "marvell,kirkwood", 191 191 NULL 192 192 };
-18
arch/arm/mach-omap2/Kconfig
··· 176 176 default y 177 177 select OMAP_PACKAGE_CBB 178 178 179 - config MACH_DEVKIT8000 180 - bool "DEVKIT8000 board" 181 - depends on ARCH_OMAP3 182 - default y 183 - select OMAP_PACKAGE_CUS 184 - 185 179 config MACH_OMAP_LDP 186 180 bool "OMAP3 LDP board" 187 181 depends on ARCH_OMAP3 ··· 220 226 select OMAP_PACKAGE_CBB 221 227 select REGULATOR_FIXED_VOLTAGE if REGULATOR 222 228 223 - config MACH_TOUCHBOOK 224 - bool "OMAP3 Touch Book" 225 - depends on ARCH_OMAP3 226 - default y 227 - select OMAP_PACKAGE_CBB 228 - 229 229 config MACH_NOKIA_N810 230 230 bool 231 231 ··· 248 260 249 261 config MACH_CM_T3730 250 262 bool 251 - 252 - config MACH_SBC3530 253 - bool "OMAP3 SBC STALKER board" 254 - depends on ARCH_OMAP3 255 - default y 256 - select OMAP_PACKAGE_CUS 257 263 258 264 config OMAP3_SDRC_AC_TIMING 259 265 bool "Enable SDRC AC timing register changes"
-4
arch/arm/mach-omap2/Makefile
··· 243 243 # Specific board support 244 244 obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o pdata-quirks.o 245 245 obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o 246 - obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o 247 246 obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o 248 247 obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o 249 248 obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o ··· 253 254 obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-peripherals.o 254 255 obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-video.o 255 256 obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o 256 - obj-$(CONFIG_MACH_TOUCHBOOK) += board-omap3touchbook.o 257 - 258 - obj-$(CONFIG_MACH_SBC3530) += board-omap3stalker.o 259 257 260 258 # Platform specific device init code 261 259
-654
arch/arm/mach-omap2/board-devkit8000.c
··· 1 - /* 2 - * board-devkit8000.c - TimLL Devkit8000 3 - * 4 - * Copyright (C) 2009 Kim Botherway 5 - * Copyright (C) 2010 Thomas Weber 6 - * 7 - * Modified from mach-omap2/board-omap3beagle.c 8 - * 9 - * Initial code: Syed Mohammed Khasim 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License version 2 as 13 - * published by the Free Software Foundation. 14 - */ 15 - 16 - #include <linux/kernel.h> 17 - #include <linux/init.h> 18 - #include <linux/platform_device.h> 19 - #include <linux/delay.h> 20 - #include <linux/err.h> 21 - #include <linux/clk.h> 22 - #include <linux/io.h> 23 - #include <linux/leds.h> 24 - #include <linux/gpio.h> 25 - #include <linux/input.h> 26 - #include <linux/gpio_keys.h> 27 - 28 - #include <linux/mtd/mtd.h> 29 - #include <linux/mtd/partitions.h> 30 - #include <linux/mtd/nand.h> 31 - #include <linux/mmc/host.h> 32 - #include <linux/usb/phy.h> 33 - 34 - #include <linux/regulator/machine.h> 35 - #include <linux/i2c/twl.h> 36 - #include "id.h" 37 - #include <asm/mach-types.h> 38 - #include <asm/mach/arch.h> 39 - #include <asm/mach/map.h> 40 - #include <asm/mach/flash.h> 41 - 42 - #include "common.h" 43 - #include "gpmc.h" 44 - #include <linux/platform_data/mtd-nand-omap2.h> 45 - #include <video/omapdss.h> 46 - #include <video/omap-panel-data.h> 47 - 48 - #include <linux/platform_data/spi-omap2-mcspi.h> 49 - #include <linux/input/matrix_keypad.h> 50 - #include <linux/spi/spi.h> 51 - #include <linux/dm9000.h> 52 - #include <linux/interrupt.h> 53 - 54 - #include "sdram-micron-mt46h32m32lf-6.h" 55 - #include "mux.h" 56 - #include "hsmmc.h" 57 - #include "board-flash.h" 58 - #include "common-board-devices.h" 59 - 60 - #define NAND_CS 0 61 - 62 - #define OMAP_DM9000_GPIO_IRQ 25 63 - #define OMAP3_DEVKIT_TS_GPIO 27 64 - 65 - static struct mtd_partition devkit8000_nand_partitions[] = { 66 - /* All the partition sizes are listed in terms of NAND block size */ 67 - { 68 - .name = "X-Loader", 69 - .offset = 0, 70 - .size = 4 * NAND_BLOCK_SIZE, 71 - .mask_flags = MTD_WRITEABLE, /* force read-only */ 72 - }, 73 - { 74 - .name = "U-Boot", 75 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */ 76 - .size = 15 * NAND_BLOCK_SIZE, 77 - .mask_flags = MTD_WRITEABLE, /* force read-only */ 78 - }, 79 - { 80 - .name = "U-Boot Env", 81 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */ 82 - .size = 1 * NAND_BLOCK_SIZE, 83 - }, 84 - { 85 - .name = "Kernel", 86 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ 87 - .size = 32 * NAND_BLOCK_SIZE, 88 - }, 89 - { 90 - .name = "File System", 91 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ 92 - .size = MTDPART_SIZ_FULL, 93 - }, 94 - }; 95 - 96 - static struct omap2_hsmmc_info mmc[] = { 97 - { 98 - .mmc = 1, 99 - .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 100 - .gpio_wp = 29, 101 - .deferred = true, 102 - }, 103 - {} /* Terminator */ 104 - }; 105 - 106 - static struct regulator_consumer_supply devkit8000_vmmc1_supply[] = { 107 - REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), 108 - }; 109 - 110 - /* ads7846 on SPI */ 111 - static struct regulator_consumer_supply devkit8000_vio_supply[] = { 112 - REGULATOR_SUPPLY("vcc", "spi2.0"), 113 - }; 114 - 115 - static const struct display_timing devkit8000_lcd_videomode = { 116 - .pixelclock = { 0, 40000000, 0 }, 117 - 118 - .hactive = { 0, 800, 0 }, 119 - .hfront_porch = { 0, 1, 0 }, 120 - .hback_porch = { 0, 1, 0 }, 121 - .hsync_len = { 0, 48, 0 }, 122 - 123 - .vactive = { 0, 480, 0 }, 124 - .vfront_porch = { 0, 12, 0 }, 125 - .vback_porch = { 0, 25, 0 }, 126 - .vsync_len = { 0, 3, 0 }, 127 - 128 - .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW | 129 - DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE, 130 - }; 131 - 132 - static struct panel_dpi_platform_data devkit8000_lcd_pdata = { 133 - .name = "lcd", 134 - .source = "dpi.0", 135 - 136 - .data_lines = 24, 137 - 138 - .display_timing = &devkit8000_lcd_videomode, 139 - 140 - .enable_gpio = -1, /* filled in code */ 141 - .backlight_gpio = -1, 142 - }; 143 - 144 - static struct platform_device devkit8000_lcd_device = { 145 - .name = "panel-dpi", 146 - .id = 0, 147 - .dev.platform_data = &devkit8000_lcd_pdata, 148 - }; 149 - 150 - static struct connector_dvi_platform_data devkit8000_dvi_connector_pdata = { 151 - .name = "dvi", 152 - .source = "tfp410.0", 153 - .i2c_bus_num = 1, 154 - }; 155 - 156 - static struct platform_device devkit8000_dvi_connector_device = { 157 - .name = "connector-dvi", 158 - .id = 0, 159 - .dev.platform_data = &devkit8000_dvi_connector_pdata, 160 - }; 161 - 162 - static struct encoder_tfp410_platform_data devkit8000_tfp410_pdata = { 163 - .name = "tfp410.0", 164 - .source = "dpi.0", 165 - .data_lines = 24, 166 - .power_down_gpio = -1, /* filled in code */ 167 - }; 168 - 169 - static struct platform_device devkit8000_tfp410_device = { 170 - .name = "tfp410", 171 - .id = 0, 172 - .dev.platform_data = &devkit8000_tfp410_pdata, 173 - }; 174 - 175 - static struct connector_atv_platform_data devkit8000_tv_pdata = { 176 - .name = "tv", 177 - .source = "venc.0", 178 - .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO, 179 - .invert_polarity = false, 180 - }; 181 - 182 - static struct platform_device devkit8000_tv_connector_device = { 183 - .name = "connector-analog-tv", 184 - .id = 0, 185 - .dev.platform_data = &devkit8000_tv_pdata, 186 - }; 187 - 188 - static struct omap_dss_board_info devkit8000_dss_data = { 189 - .default_display_name = "lcd", 190 - }; 191 - 192 - static uint32_t board_keymap[] = { 193 - KEY(0, 0, KEY_1), 194 - KEY(1, 0, KEY_2), 195 - KEY(2, 0, KEY_3), 196 - KEY(0, 1, KEY_4), 197 - KEY(1, 1, KEY_5), 198 - KEY(2, 1, KEY_6), 199 - KEY(3, 1, KEY_F5), 200 - KEY(0, 2, KEY_7), 201 - KEY(1, 2, KEY_8), 202 - KEY(2, 2, KEY_9), 203 - KEY(3, 2, KEY_F6), 204 - KEY(0, 3, KEY_F7), 205 - KEY(1, 3, KEY_0), 206 - KEY(2, 3, KEY_F8), 207 - PERSISTENT_KEY(4, 5), 208 - KEY(4, 4, KEY_VOLUMEUP), 209 - KEY(5, 5, KEY_VOLUMEDOWN), 210 - 0 211 - }; 212 - 213 - static struct matrix_keymap_data board_map_data = { 214 - .keymap = board_keymap, 215 - .keymap_size = ARRAY_SIZE(board_keymap), 216 - }; 217 - 218 - static struct twl4030_keypad_data devkit8000_kp_data = { 219 - .keymap_data = &board_map_data, 220 - .rows = 6, 221 - .cols = 6, 222 - .rep = 1, 223 - }; 224 - 225 - static struct gpio_led gpio_leds[]; 226 - 227 - static int devkit8000_twl_gpio_setup(struct device *dev, 228 - unsigned gpio, unsigned ngpio) 229 - { 230 - /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 231 - mmc[0].gpio_cd = gpio + 0; 232 - omap_hsmmc_late_init(mmc); 233 - 234 - /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 235 - gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 236 - 237 - /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ 238 - devkit8000_lcd_pdata.enable_gpio = gpio + TWL4030_GPIO_MAX + 0; 239 - 240 - /* gpio + 7 is "DVI_PD" (out, active low) */ 241 - devkit8000_tfp410_pdata.power_down_gpio = gpio + 7; 242 - 243 - return 0; 244 - } 245 - 246 - static struct twl4030_gpio_platform_data devkit8000_gpio_data = { 247 - .use_leds = true, 248 - .pulldowns = BIT(1) | BIT(2) | BIT(6) | BIT(8) | BIT(13) 249 - | BIT(15) | BIT(16) | BIT(17), 250 - .setup = devkit8000_twl_gpio_setup, 251 - }; 252 - 253 - static struct regulator_consumer_supply devkit8000_vpll1_supplies[] = { 254 - REGULATOR_SUPPLY("vdds_dsi", "omapdss"), 255 - REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"), 256 - REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"), 257 - }; 258 - 259 - /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ 260 - static struct regulator_init_data devkit8000_vmmc1 = { 261 - .constraints = { 262 - .min_uV = 1850000, 263 - .max_uV = 3150000, 264 - .valid_modes_mask = REGULATOR_MODE_NORMAL 265 - | REGULATOR_MODE_STANDBY, 266 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE 267 - | REGULATOR_CHANGE_MODE 268 - | REGULATOR_CHANGE_STATUS, 269 - }, 270 - .num_consumer_supplies = ARRAY_SIZE(devkit8000_vmmc1_supply), 271 - .consumer_supplies = devkit8000_vmmc1_supply, 272 - }; 273 - 274 - /* VPLL1 for digital video outputs */ 275 - static struct regulator_init_data devkit8000_vpll1 = { 276 - .constraints = { 277 - .min_uV = 1800000, 278 - .max_uV = 1800000, 279 - .valid_modes_mask = REGULATOR_MODE_NORMAL 280 - | REGULATOR_MODE_STANDBY, 281 - .valid_ops_mask = REGULATOR_CHANGE_MODE 282 - | REGULATOR_CHANGE_STATUS, 283 - }, 284 - .num_consumer_supplies = ARRAY_SIZE(devkit8000_vpll1_supplies), 285 - .consumer_supplies = devkit8000_vpll1_supplies, 286 - }; 287 - 288 - /* VAUX4 for ads7846 and nubs */ 289 - static struct regulator_init_data devkit8000_vio = { 290 - .constraints = { 291 - .min_uV = 1800000, 292 - .max_uV = 1800000, 293 - .apply_uV = true, 294 - .valid_modes_mask = REGULATOR_MODE_NORMAL 295 - | REGULATOR_MODE_STANDBY, 296 - .valid_ops_mask = REGULATOR_CHANGE_MODE 297 - | REGULATOR_CHANGE_STATUS, 298 - }, 299 - .num_consumer_supplies = ARRAY_SIZE(devkit8000_vio_supply), 300 - .consumer_supplies = devkit8000_vio_supply, 301 - }; 302 - 303 - static struct twl4030_platform_data devkit8000_twldata = { 304 - /* platform_data for children goes here */ 305 - .gpio = &devkit8000_gpio_data, 306 - .vmmc1 = &devkit8000_vmmc1, 307 - .vpll1 = &devkit8000_vpll1, 308 - .vio = &devkit8000_vio, 309 - .keypad = &devkit8000_kp_data, 310 - }; 311 - 312 - static int __init devkit8000_i2c_init(void) 313 - { 314 - omap3_pmic_get_config(&devkit8000_twldata, 315 - TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO, 316 - TWL_COMMON_REGULATOR_VDAC); 317 - omap3_pmic_init("tps65930", &devkit8000_twldata); 318 - /* Bus 3 is attached to the DVI port where devices like the pico DLP 319 - * projector don't work reliably with 400kHz */ 320 - omap_register_i2c_bus(3, 400, NULL, 0); 321 - return 0; 322 - } 323 - 324 - static struct gpio_led gpio_leds[] = { 325 - { 326 - .name = "led1", 327 - .default_trigger = "heartbeat", 328 - .gpio = 186, 329 - .active_low = true, 330 - }, 331 - { 332 - .name = "led2", 333 - .default_trigger = "mmc0", 334 - .gpio = 163, 335 - .active_low = true, 336 - }, 337 - { 338 - .name = "ledB", 339 - .default_trigger = "none", 340 - .gpio = 153, 341 - .active_low = true, 342 - }, 343 - { 344 - .name = "led3", 345 - .default_trigger = "none", 346 - .gpio = 164, 347 - .active_low = true, 348 - }, 349 - }; 350 - 351 - static struct gpio_led_platform_data gpio_led_info = { 352 - .leds = gpio_leds, 353 - .num_leds = ARRAY_SIZE(gpio_leds), 354 - }; 355 - 356 - static struct platform_device leds_gpio = { 357 - .name = "leds-gpio", 358 - .id = -1, 359 - .dev = { 360 - .platform_data = &gpio_led_info, 361 - }, 362 - }; 363 - 364 - static struct gpio_keys_button gpio_buttons[] = { 365 - { 366 - .code = BTN_EXTRA, 367 - .gpio = 26, 368 - .desc = "user", 369 - .wakeup = 1, 370 - }, 371 - }; 372 - 373 - static struct gpio_keys_platform_data gpio_key_info = { 374 - .buttons = gpio_buttons, 375 - .nbuttons = ARRAY_SIZE(gpio_buttons), 376 - }; 377 - 378 - static struct platform_device keys_gpio = { 379 - .name = "gpio-keys", 380 - .id = -1, 381 - .dev = { 382 - .platform_data = &gpio_key_info, 383 - }, 384 - }; 385 - 386 - #define OMAP_DM9000_BASE 0x2c000000 387 - 388 - static struct resource omap_dm9000_resources[] = { 389 - [0] = { 390 - .start = OMAP_DM9000_BASE, 391 - .end = (OMAP_DM9000_BASE + 0x4 - 1), 392 - .flags = IORESOURCE_MEM, 393 - }, 394 - [1] = { 395 - .start = (OMAP_DM9000_BASE + 0x400), 396 - .end = (OMAP_DM9000_BASE + 0x400 + 0x4 - 1), 397 - .flags = IORESOURCE_MEM, 398 - }, 399 - [2] = { 400 - .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, 401 - }, 402 - }; 403 - 404 - static struct dm9000_plat_data omap_dm9000_platdata = { 405 - .flags = DM9000_PLATF_16BITONLY, 406 - }; 407 - 408 - static struct platform_device omap_dm9000_dev = { 409 - .name = "dm9000", 410 - .id = -1, 411 - .num_resources = ARRAY_SIZE(omap_dm9000_resources), 412 - .resource = omap_dm9000_resources, 413 - .dev = { 414 - .platform_data = &omap_dm9000_platdata, 415 - }, 416 - }; 417 - 418 - static void __init omap_dm9000_init(void) 419 - { 420 - unsigned char *eth_addr = omap_dm9000_platdata.dev_addr; 421 - struct omap_die_id odi; 422 - int ret; 423 - 424 - ret = gpio_request_one(OMAP_DM9000_GPIO_IRQ, GPIOF_IN, "dm9000 irq"); 425 - if (ret < 0) { 426 - printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n", 427 - OMAP_DM9000_GPIO_IRQ); 428 - return; 429 - } 430 - 431 - /* init the mac address using DIE id */ 432 - omap_get_die_id(&odi); 433 - 434 - eth_addr[0] = 0x02; /* locally administered */ 435 - eth_addr[1] = odi.id_1 & 0xff; 436 - eth_addr[2] = (odi.id_0 & 0xff000000) >> 24; 437 - eth_addr[3] = (odi.id_0 & 0x00ff0000) >> 16; 438 - eth_addr[4] = (odi.id_0 & 0x0000ff00) >> 8; 439 - eth_addr[5] = (odi.id_0 & 0x000000ff); 440 - } 441 - 442 - static struct platform_device *devkit8000_devices[] __initdata = { 443 - &leds_gpio, 444 - &keys_gpio, 445 - &omap_dm9000_dev, 446 - &devkit8000_lcd_device, 447 - &devkit8000_tfp410_device, 448 - &devkit8000_dvi_connector_device, 449 - &devkit8000_tv_connector_device, 450 - }; 451 - 452 - static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 453 - .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 454 - }; 455 - 456 - #ifdef CONFIG_OMAP_MUX 457 - static struct omap_board_mux board_mux[] __initdata = { 458 - /* nCS and IRQ for Devkit8000 ethernet */ 459 - OMAP3_MUX(GPMC_NCS6, OMAP_MUX_MODE0), 460 - OMAP3_MUX(ETK_D11, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP), 461 - 462 - /* McSPI 2*/ 463 - OMAP3_MUX(MCSPI2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 464 - OMAP3_MUX(MCSPI2_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 465 - OMAP3_MUX(MCSPI2_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 466 - OMAP3_MUX(MCSPI2_CS0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 467 - OMAP3_MUX(MCSPI2_CS1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 468 - 469 - /* PENDOWN GPIO */ 470 - OMAP3_MUX(ETK_D13, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), 471 - 472 - /* mUSB */ 473 - OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 474 - OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 475 - OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 476 - OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 477 - OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 478 - OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 479 - OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 480 - OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 481 - OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 482 - OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 483 - OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 484 - OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 485 - 486 - /* USB 1 */ 487 - OMAP3_MUX(ETK_CTL, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 488 - OMAP3_MUX(ETK_CLK, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT), 489 - OMAP3_MUX(ETK_D8, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 490 - OMAP3_MUX(ETK_D9, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 491 - OMAP3_MUX(ETK_D0, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 492 - OMAP3_MUX(ETK_D1, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 493 - OMAP3_MUX(ETK_D2, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 494 - OMAP3_MUX(ETK_D3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 495 - OMAP3_MUX(ETK_D4, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 496 - OMAP3_MUX(ETK_D5, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 497 - OMAP3_MUX(ETK_D6, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 498 - OMAP3_MUX(ETK_D7, OMAP_MUX_MODE3 | OMAP_PIN_INPUT), 499 - 500 - /* MMC 1 */ 501 - OMAP3_MUX(SDMMC1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 502 - OMAP3_MUX(SDMMC1_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 503 - OMAP3_MUX(SDMMC1_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 504 - OMAP3_MUX(SDMMC1_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 505 - OMAP3_MUX(SDMMC1_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 506 - OMAP3_MUX(SDMMC1_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 507 - OMAP3_MUX(SDMMC1_DAT4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 508 - OMAP3_MUX(SDMMC1_DAT5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 509 - OMAP3_MUX(SDMMC1_DAT6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 510 - OMAP3_MUX(SDMMC1_DAT7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 511 - 512 - /* McBSP 2 */ 513 - OMAP3_MUX(MCBSP2_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 514 - OMAP3_MUX(MCBSP2_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 515 - OMAP3_MUX(MCBSP2_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 516 - OMAP3_MUX(MCBSP2_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 517 - 518 - /* I2C 1 */ 519 - OMAP3_MUX(I2C1_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 520 - OMAP3_MUX(I2C1_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 521 - 522 - /* I2C 2 */ 523 - OMAP3_MUX(I2C2_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 524 - OMAP3_MUX(I2C2_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 525 - 526 - /* I2C 3 */ 527 - OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 528 - OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 529 - 530 - /* I2C 4 */ 531 - OMAP3_MUX(I2C4_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 532 - OMAP3_MUX(I2C4_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 533 - 534 - /* serial ports */ 535 - OMAP3_MUX(MCBSP3_CLKX, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), 536 - OMAP3_MUX(MCBSP3_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), 537 - OMAP3_MUX(UART1_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 538 - OMAP3_MUX(UART1_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 539 - 540 - /* DSS */ 541 - OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 542 - OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 543 - OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 544 - OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 545 - OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 546 - OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 547 - OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 548 - OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 549 - OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 550 - OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 551 - OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 552 - OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 553 - OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 554 - OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 555 - OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 556 - OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 557 - OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 558 - OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 559 - OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 560 - OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 561 - OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 562 - OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 563 - OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 564 - OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 565 - OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 566 - OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 567 - OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 568 - OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 569 - 570 - /* expansion port */ 571 - /* McSPI 1 */ 572 - OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 573 - OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 574 - OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 575 - OMAP3_MUX(MCSPI1_CS0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN), 576 - OMAP3_MUX(MCSPI1_CS3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN), 577 - 578 - /* HDQ */ 579 - OMAP3_MUX(HDQ_SIO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 580 - 581 - /* McSPI4 */ 582 - OMAP3_MUX(MCBSP1_CLKR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), 583 - OMAP3_MUX(MCBSP1_DX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), 584 - OMAP3_MUX(MCBSP1_DR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), 585 - OMAP3_MUX(MCBSP1_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP), 586 - 587 - /* MMC 2 */ 588 - OMAP3_MUX(SDMMC2_DAT4, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), 589 - OMAP3_MUX(SDMMC2_DAT5, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), 590 - OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), 591 - OMAP3_MUX(SDMMC2_DAT7, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), 592 - 593 - /* I2C3 */ 594 - OMAP3_MUX(I2C3_SCL, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 595 - OMAP3_MUX(I2C3_SDA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 596 - 597 - OMAP3_MUX(MCBSP1_CLKX, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 598 - OMAP3_MUX(MCBSP_CLKS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 599 - OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 600 - 601 - OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 602 - OMAP3_MUX(GPMC_NCS3, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 603 - 604 - /* TPS IRQ */ 605 - OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \ 606 - OMAP_PIN_INPUT_PULLUP), 607 - 608 - { .reg_offset = OMAP_MUX_TERMINATOR }, 609 - }; 610 - #endif 611 - 612 - static void __init devkit8000_init(void) 613 - { 614 - omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); 615 - omap_serial_init(); 616 - omap_sdrc_init(mt46h32m32lf6_sdrc_params, 617 - mt46h32m32lf6_sdrc_params); 618 - 619 - omap_dm9000_init(); 620 - 621 - omap_hsmmc_init(mmc); 622 - devkit8000_i2c_init(); 623 - omap_dm9000_resources[2].start = gpio_to_irq(OMAP_DM9000_GPIO_IRQ); 624 - platform_add_devices(devkit8000_devices, 625 - ARRAY_SIZE(devkit8000_devices)); 626 - 627 - omap_display_init(&devkit8000_dss_data); 628 - 629 - omap_ads7846_init(2, OMAP3_DEVKIT_TS_GPIO, 0, NULL); 630 - 631 - usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 632 - usb_musb_init(NULL); 633 - usbhs_init(&usbhs_bdata); 634 - board_nand_init(devkit8000_nand_partitions, 635 - ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS, 636 - NAND_BUSWIDTH_16, NULL); 637 - omap_twl4030_audio_init("omap3beagle", NULL); 638 - 639 - /* Ensure SDRC pins are mux'd for self-refresh */ 640 - omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 641 - omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); 642 - } 643 - 644 - MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000") 645 - .atag_offset = 0x100, 646 - .reserve = omap_reserve, 647 - .map_io = omap3_map_io, 648 - .init_early = omap35xx_init_early, 649 - .init_irq = omap3_init_irq, 650 - .init_machine = devkit8000_init, 651 - .init_late = omap35xx_init_late, 652 - .init_time = omap3_secure_sync32k_timer_init, 653 - .restart = omap3xxx_restart, 654 - MACHINE_END
-433
arch/arm/mach-omap2/board-omap3stalker.c
··· 1 - /* 2 - * linux/arch/arm/mach-omap2/board-omap3evm.c 3 - * 4 - * Copyright (C) 2008 Guangzhou EMA-Tech 5 - * 6 - * Modified from mach-omap2/board-omap3evm.c 7 - * 8 - * Initial code: Syed Mohammed Khasim 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 - */ 14 - 15 - #include <linux/kernel.h> 16 - #include <linux/init.h> 17 - #include <linux/platform_device.h> 18 - #include <linux/delay.h> 19 - #include <linux/err.h> 20 - #include <linux/clk.h> 21 - #include <linux/io.h> 22 - #include <linux/leds.h> 23 - #include <linux/gpio.h> 24 - #include <linux/input.h> 25 - #include <linux/gpio_keys.h> 26 - 27 - #include <linux/regulator/fixed.h> 28 - #include <linux/regulator/machine.h> 29 - #include <linux/i2c/twl.h> 30 - #include <linux/mmc/host.h> 31 - #include <linux/input/matrix_keypad.h> 32 - #include <linux/spi/spi.h> 33 - #include <linux/interrupt.h> 34 - #include <linux/smsc911x.h> 35 - #include <linux/platform_data/at24.h> 36 - #include <linux/usb/phy.h> 37 - 38 - #include <asm/mach-types.h> 39 - #include <asm/mach/arch.h> 40 - #include <asm/mach/map.h> 41 - #include <asm/mach/flash.h> 42 - 43 - #include "common.h" 44 - #include "gpmc.h" 45 - #include <linux/platform_data/mtd-nand-omap2.h> 46 - #include <video/omapdss.h> 47 - #include <video/omap-panel-data.h> 48 - 49 - #include <linux/platform_data/spi-omap2-mcspi.h> 50 - 51 - #include "sdram-micron-mt46h32m32lf-6.h" 52 - #include "mux.h" 53 - #include "hsmmc.h" 54 - #include "common-board-devices.h" 55 - 56 - #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 57 - #include "gpmc-smsc911x.h" 58 - 59 - #define OMAP3STALKER_ETHR_START 0x2c000000 60 - #define OMAP3STALKER_ETHR_SIZE 1024 61 - #define OMAP3STALKER_ETHR_GPIO_IRQ 19 62 - #define OMAP3STALKER_SMC911X_CS 5 63 - 64 - static struct omap_smsc911x_platform_data smsc911x_cfg = { 65 - .cs = OMAP3STALKER_SMC911X_CS, 66 - .gpio_irq = OMAP3STALKER_ETHR_GPIO_IRQ, 67 - .gpio_reset = -EINVAL, 68 - .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), 69 - }; 70 - 71 - static inline void __init omap3stalker_init_eth(void) 72 - { 73 - omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP); 74 - gpmc_smsc911x_init(&smsc911x_cfg); 75 - } 76 - 77 - #else 78 - static inline void __init omap3stalker_init_eth(void) 79 - { 80 - return; 81 - } 82 - #endif 83 - 84 - /* 85 - * OMAP3 DSS control signals 86 - */ 87 - 88 - #define DSS_ENABLE_GPIO 199 89 - #define LCD_PANEL_BKLIGHT_GPIO 210 90 - #define ENABLE_VPLL2_DEV_GRP 0xE0 91 - 92 - static void __init omap3_stalker_display_init(void) 93 - { 94 - return; 95 - } 96 - static struct connector_dvi_platform_data omap3stalker_dvi_connector_pdata = { 97 - .name = "dvi", 98 - .source = "tfp410.0", 99 - .i2c_bus_num = -1, 100 - }; 101 - 102 - static struct platform_device omap3stalker_dvi_connector_device = { 103 - .name = "connector-dvi", 104 - .id = 0, 105 - .dev.platform_data = &omap3stalker_dvi_connector_pdata, 106 - }; 107 - 108 - static struct encoder_tfp410_platform_data omap3stalker_tfp410_pdata = { 109 - .name = "tfp410.0", 110 - .source = "dpi.0", 111 - .data_lines = 24, 112 - .power_down_gpio = DSS_ENABLE_GPIO, 113 - }; 114 - 115 - static struct platform_device omap3stalker_tfp410_device = { 116 - .name = "tfp410", 117 - .id = 0, 118 - .dev.platform_data = &omap3stalker_tfp410_pdata, 119 - }; 120 - 121 - static struct connector_atv_platform_data omap3stalker_tv_pdata = { 122 - .name = "tv", 123 - .source = "venc.0", 124 - .connector_type = OMAP_DSS_VENC_TYPE_COMPOSITE, 125 - .invert_polarity = false, 126 - }; 127 - 128 - static struct platform_device omap3stalker_tv_connector_device = { 129 - .name = "connector-analog-tv", 130 - .id = 0, 131 - .dev.platform_data = &omap3stalker_tv_pdata, 132 - }; 133 - 134 - static struct omap_dss_board_info omap3_stalker_dss_data = { 135 - .default_display_name = "dvi", 136 - }; 137 - 138 - static struct regulator_consumer_supply omap3stalker_vmmc1_supply[] = { 139 - REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), 140 - }; 141 - 142 - static struct regulator_consumer_supply omap3stalker_vsim_supply[] = { 143 - REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"), 144 - }; 145 - 146 - /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ 147 - static struct regulator_init_data omap3stalker_vmmc1 = { 148 - .constraints = { 149 - .min_uV = 1850000, 150 - .max_uV = 3150000, 151 - .valid_modes_mask = REGULATOR_MODE_NORMAL 152 - | REGULATOR_MODE_STANDBY, 153 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE 154 - | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, 155 - }, 156 - .num_consumer_supplies = ARRAY_SIZE(omap3stalker_vmmc1_supply), 157 - .consumer_supplies = omap3stalker_vmmc1_supply, 158 - }; 159 - 160 - /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ 161 - static struct regulator_init_data omap3stalker_vsim = { 162 - .constraints = { 163 - .min_uV = 1800000, 164 - .max_uV = 3000000, 165 - .valid_modes_mask = REGULATOR_MODE_NORMAL 166 - | REGULATOR_MODE_STANDBY, 167 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE 168 - | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, 169 - }, 170 - .num_consumer_supplies = ARRAY_SIZE(omap3stalker_vsim_supply), 171 - .consumer_supplies = omap3stalker_vsim_supply, 172 - }; 173 - 174 - static struct omap2_hsmmc_info mmc[] = { 175 - { 176 - .mmc = 1, 177 - .caps = MMC_CAP_4_BIT_DATA, 178 - .gpio_cd = -EINVAL, 179 - .gpio_wp = 23, 180 - .deferred = true, 181 - }, 182 - {} /* Terminator */ 183 - }; 184 - 185 - static struct gpio_keys_button gpio_buttons[] = { 186 - { 187 - .code = BTN_EXTRA, 188 - .gpio = 18, 189 - .desc = "user", 190 - .wakeup = 1, 191 - }, 192 - }; 193 - 194 - static struct gpio_keys_platform_data gpio_key_info = { 195 - .buttons = gpio_buttons, 196 - .nbuttons = ARRAY_SIZE(gpio_buttons), 197 - }; 198 - 199 - static struct platform_device keys_gpio = { 200 - .name = "gpio-keys", 201 - .id = -1, 202 - .dev = { 203 - .platform_data = &gpio_key_info, 204 - }, 205 - }; 206 - 207 - static struct gpio_led gpio_leds[] = { 208 - { 209 - .name = "stalker:D8:usr0", 210 - .default_trigger = "default-on", 211 - .gpio = 126, 212 - }, 213 - { 214 - .name = "stalker:D9:usr1", 215 - .default_trigger = "default-on", 216 - .gpio = 127, 217 - }, 218 - { 219 - .name = "stalker:D3:mmc0", 220 - .gpio = -EINVAL, /* gets replaced */ 221 - .active_low = true, 222 - .default_trigger = "mmc0", 223 - }, 224 - { 225 - .name = "stalker:D4:heartbeat", 226 - .gpio = -EINVAL, /* gets replaced */ 227 - .active_low = true, 228 - .default_trigger = "heartbeat", 229 - }, 230 - }; 231 - 232 - static struct gpio_led_platform_data gpio_led_info = { 233 - .leds = gpio_leds, 234 - .num_leds = ARRAY_SIZE(gpio_leds), 235 - }; 236 - 237 - static struct platform_device leds_gpio = { 238 - .name = "leds-gpio", 239 - .id = -1, 240 - .dev = { 241 - .platform_data = &gpio_led_info, 242 - }, 243 - }; 244 - 245 - static int 246 - omap3stalker_twl_gpio_setup(struct device *dev, 247 - unsigned gpio, unsigned ngpio) 248 - { 249 - /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 250 - mmc[0].gpio_cd = gpio + 0; 251 - omap_hsmmc_late_init(mmc); 252 - 253 - /* 254 - * Most GPIOs are for USB OTG. Some are mostly sent to 255 - * the P2 connector; notably LEDA for the LCD backlight. 256 - */ 257 - 258 - /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ 259 - gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW, 260 - "EN_LCD_BKL"); 261 - 262 - /* gpio + 7 == DVI Enable */ 263 - gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI"); 264 - 265 - /* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */ 266 - gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 267 - /* GPIO + 13 == ledsync (out, heartbeat) */ 268 - gpio_leds[3].gpio = gpio + 13; 269 - 270 - platform_device_register(&leds_gpio); 271 - return 0; 272 - } 273 - 274 - static struct twl4030_gpio_platform_data omap3stalker_gpio_data = { 275 - .use_leds = true, 276 - .setup = omap3stalker_twl_gpio_setup, 277 - }; 278 - 279 - static uint32_t board_keymap[] = { 280 - KEY(0, 0, KEY_LEFT), 281 - KEY(0, 1, KEY_DOWN), 282 - KEY(0, 2, KEY_ENTER), 283 - KEY(0, 3, KEY_M), 284 - 285 - KEY(1, 0, KEY_RIGHT), 286 - KEY(1, 1, KEY_UP), 287 - KEY(1, 2, KEY_I), 288 - KEY(1, 3, KEY_N), 289 - 290 - KEY(2, 0, KEY_A), 291 - KEY(2, 1, KEY_E), 292 - KEY(2, 2, KEY_J), 293 - KEY(2, 3, KEY_O), 294 - 295 - KEY(3, 0, KEY_B), 296 - KEY(3, 1, KEY_F), 297 - KEY(3, 2, KEY_K), 298 - KEY(3, 3, KEY_P) 299 - }; 300 - 301 - static struct matrix_keymap_data board_map_data = { 302 - .keymap = board_keymap, 303 - .keymap_size = ARRAY_SIZE(board_keymap), 304 - }; 305 - 306 - static struct twl4030_keypad_data omap3stalker_kp_data = { 307 - .keymap_data = &board_map_data, 308 - .rows = 4, 309 - .cols = 4, 310 - .rep = 1, 311 - }; 312 - 313 - static struct twl4030_platform_data omap3stalker_twldata = { 314 - /* platform_data for children goes here */ 315 - .keypad = &omap3stalker_kp_data, 316 - .gpio = &omap3stalker_gpio_data, 317 - .vmmc1 = &omap3stalker_vmmc1, 318 - .vsim = &omap3stalker_vsim, 319 - }; 320 - 321 - static struct at24_platform_data fram_info = { 322 - .byte_len = (64 * 1024) / 8, 323 - .page_size = 8192, 324 - .flags = AT24_FLAG_ADDR16 | AT24_FLAG_IRUGO, 325 - }; 326 - 327 - static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo3[] = { 328 - { 329 - I2C_BOARD_INFO("24c64", 0x50), 330 - .flags = I2C_CLIENT_WAKE, 331 - .platform_data = &fram_info, 332 - }, 333 - }; 334 - 335 - static int __init omap3_stalker_i2c_init(void) 336 - { 337 - omap3_pmic_get_config(&omap3stalker_twldata, 338 - TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC | 339 - TWL_COMMON_PDATA_AUDIO, 340 - TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2); 341 - 342 - omap3stalker_twldata.vdac->constraints.apply_uV = true; 343 - omap3stalker_twldata.vpll2->constraints.apply_uV = true; 344 - omap3stalker_twldata.vpll2->constraints.name = "VDVI"; 345 - 346 - omap3_pmic_init("twl4030", &omap3stalker_twldata); 347 - omap_register_i2c_bus(2, 400, NULL, 0); 348 - omap_register_i2c_bus(3, 400, omap3stalker_i2c_boardinfo3, 349 - ARRAY_SIZE(omap3stalker_i2c_boardinfo3)); 350 - return 0; 351 - } 352 - 353 - #define OMAP3_STALKER_TS_GPIO 175 354 - 355 - static struct usbhs_phy_data phy_data[] __initdata = { 356 - { 357 - .port = 2, 358 - .reset_gpio = 21, 359 - .vcc_gpio = -EINVAL, 360 - }, 361 - }; 362 - 363 - static struct platform_device *omap3_stalker_devices[] __initdata = { 364 - &keys_gpio, 365 - &omap3stalker_tfp410_device, 366 - &omap3stalker_dvi_connector_device, 367 - &omap3stalker_tv_connector_device, 368 - }; 369 - 370 - static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 371 - .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 372 - }; 373 - 374 - #ifdef CONFIG_OMAP_MUX 375 - static struct omap_board_mux board_mux[] __initdata = { 376 - OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP | 377 - OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE), 378 - OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | 379 - OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE), 380 - {.reg_offset = OMAP_MUX_TERMINATOR}, 381 - }; 382 - #endif 383 - 384 - static struct regulator_consumer_supply dummy_supplies[] = { 385 - REGULATOR_SUPPLY("vddvario", "smsc911x.0"), 386 - REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), 387 - }; 388 - 389 - static void __init omap3_stalker_init(void) 390 - { 391 - regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 392 - omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); 393 - 394 - omap_mux_init_gpio(23, OMAP_PIN_INPUT); 395 - omap_hsmmc_init(mmc); 396 - 397 - omap3_stalker_i2c_init(); 398 - 399 - platform_add_devices(omap3_stalker_devices, 400 - ARRAY_SIZE(omap3_stalker_devices)); 401 - 402 - omap_display_init(&omap3_stalker_dss_data); 403 - 404 - omap_serial_init(); 405 - omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL); 406 - usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 407 - usb_musb_init(NULL); 408 - 409 - usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 410 - usbhs_init(&usbhs_bdata); 411 - omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); 412 - 413 - omap_mux_init_gpio(21, OMAP_PIN_OUTPUT); 414 - omap_mux_init_gpio(18, OMAP_PIN_INPUT_PULLUP); 415 - 416 - omap3stalker_init_eth(); 417 - omap3_stalker_display_init(); 418 - /* Ensure SDRC pins are mux'd for self-refresh */ 419 - omap_mux_init_signal("sdr_cke0", OMAP_PIN_OUTPUT); 420 - omap_mux_init_signal("sdr_cke1", OMAP_PIN_OUTPUT); 421 - } 422 - 423 - MACHINE_START(SBC3530, "OMAP3 STALKER") 424 - /* Maintainer: Jason Lam -lzg@ema-tech.com */ 425 - .atag_offset = 0x100, 426 - .map_io = omap3_map_io, 427 - .init_early = omap35xx_init_early, 428 - .init_irq = omap3_init_irq, 429 - .init_machine = omap3_stalker_init, 430 - .init_late = omap35xx_init_late, 431 - .init_time = omap3_secure_sync32k_timer_init, 432 - .restart = omap3xxx_restart, 433 - MACHINE_END
-395
arch/arm/mach-omap2/board-omap3touchbook.c
··· 1 - /* 2 - * linux/arch/arm/mach-omap2/board-omap3touchbook.c 3 - * 4 - * Copyright (C) 2009 Always Innovating 5 - * 6 - * Modified from mach-omap2/board-omap3beagleboard.c 7 - * 8 - * Initial code: Grégoire Gentil, Tim Yamin 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 - */ 14 - 15 - #include <linux/kernel.h> 16 - #include <linux/init.h> 17 - #include <linux/platform_device.h> 18 - #include <linux/delay.h> 19 - #include <linux/err.h> 20 - #include <linux/clk.h> 21 - #include <linux/io.h> 22 - #include <linux/leds.h> 23 - #include <linux/gpio.h> 24 - #include <linux/input.h> 25 - #include <linux/gpio_keys.h> 26 - 27 - #include <linux/mtd/mtd.h> 28 - #include <linux/mtd/partitions.h> 29 - #include <linux/mtd/nand.h> 30 - #include <linux/mmc/host.h> 31 - #include <linux/usb/phy.h> 32 - 33 - #include <linux/platform_data/spi-omap2-mcspi.h> 34 - #include <linux/spi/spi.h> 35 - 36 - #include <linux/spi/ads7846.h> 37 - 38 - #include <linux/regulator/machine.h> 39 - #include <linux/i2c/twl.h> 40 - 41 - #include <asm/mach-types.h> 42 - #include <asm/mach/arch.h> 43 - #include <asm/mach/map.h> 44 - #include <asm/mach/flash.h> 45 - #include <asm/system_info.h> 46 - 47 - #include "common.h" 48 - #include "gpmc.h" 49 - #include <linux/platform_data/mtd-nand-omap2.h> 50 - 51 - #include "mux.h" 52 - #include "hsmmc.h" 53 - #include "board-flash.h" 54 - #include "common-board-devices.h" 55 - 56 - #include <asm/setup.h> 57 - 58 - #define OMAP3_AC_GPIO 136 59 - #define OMAP3_TS_GPIO 162 60 - #define TB_BL_PWM_TIMER 9 61 - #define TB_KILL_POWER_GPIO 168 62 - 63 - #define NAND_CS 0 64 - 65 - static unsigned long touchbook_revision; 66 - 67 - static struct mtd_partition omap3touchbook_nand_partitions[] = { 68 - /* All the partition sizes are listed in terms of NAND block size */ 69 - { 70 - .name = "X-Loader", 71 - .offset = 0, 72 - .size = 4 * NAND_BLOCK_SIZE, 73 - .mask_flags = MTD_WRITEABLE, /* force read-only */ 74 - }, 75 - { 76 - .name = "U-Boot", 77 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */ 78 - .size = 15 * NAND_BLOCK_SIZE, 79 - .mask_flags = MTD_WRITEABLE, /* force read-only */ 80 - }, 81 - { 82 - .name = "U-Boot Env", 83 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */ 84 - .size = 1 * NAND_BLOCK_SIZE, 85 - }, 86 - { 87 - .name = "Kernel", 88 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ 89 - .size = 32 * NAND_BLOCK_SIZE, 90 - }, 91 - { 92 - .name = "File System", 93 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ 94 - .size = MTDPART_SIZ_FULL, 95 - }, 96 - }; 97 - 98 - #include "sdram-micron-mt46h32m32lf-6.h" 99 - 100 - static struct omap2_hsmmc_info mmc[] = { 101 - { 102 - .mmc = 1, 103 - .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 104 - .gpio_wp = 29, 105 - .deferred = true, 106 - }, 107 - {} /* Terminator */ 108 - }; 109 - 110 - static struct regulator_consumer_supply touchbook_vmmc1_supply[] = { 111 - REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), 112 - }; 113 - 114 - static struct regulator_consumer_supply touchbook_vsim_supply[] = { 115 - REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"), 116 - }; 117 - 118 - static struct gpio_led gpio_leds[]; 119 - 120 - static int touchbook_twl_gpio_setup(struct device *dev, 121 - unsigned gpio, unsigned ngpio) 122 - { 123 - /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 124 - mmc[0].gpio_cd = gpio + 0; 125 - omap_hsmmc_late_init(mmc); 126 - 127 - /* REVISIT: need ehci-omap hooks for external VBUS 128 - * power switch and overcurrent detect 129 - */ 130 - gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"); 131 - 132 - /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ 133 - gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW, 134 - "nEN_USB_PWR"); 135 - 136 - /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 137 - gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 138 - 139 - return 0; 140 - } 141 - 142 - static struct twl4030_gpio_platform_data touchbook_gpio_data = { 143 - .use_leds = true, 144 - .pullups = BIT(1), 145 - .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13) 146 - | BIT(15) | BIT(16) | BIT(17), 147 - .setup = touchbook_twl_gpio_setup, 148 - }; 149 - 150 - static struct regulator_consumer_supply touchbook_vdac_supply[] = { 151 - { 152 - .supply = "vdac", 153 - }, 154 - }; 155 - 156 - static struct regulator_consumer_supply touchbook_vdvi_supply[] = { 157 - { 158 - .supply = "vdvi", 159 - }, 160 - }; 161 - 162 - /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ 163 - static struct regulator_init_data touchbook_vmmc1 = { 164 - .constraints = { 165 - .min_uV = 1850000, 166 - .max_uV = 3150000, 167 - .valid_modes_mask = REGULATOR_MODE_NORMAL 168 - | REGULATOR_MODE_STANDBY, 169 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE 170 - | REGULATOR_CHANGE_MODE 171 - | REGULATOR_CHANGE_STATUS, 172 - }, 173 - .num_consumer_supplies = ARRAY_SIZE(touchbook_vmmc1_supply), 174 - .consumer_supplies = touchbook_vmmc1_supply, 175 - }; 176 - 177 - /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ 178 - static struct regulator_init_data touchbook_vsim = { 179 - .constraints = { 180 - .min_uV = 1800000, 181 - .max_uV = 3000000, 182 - .valid_modes_mask = REGULATOR_MODE_NORMAL 183 - | REGULATOR_MODE_STANDBY, 184 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE 185 - | REGULATOR_CHANGE_MODE 186 - | REGULATOR_CHANGE_STATUS, 187 - }, 188 - .num_consumer_supplies = ARRAY_SIZE(touchbook_vsim_supply), 189 - .consumer_supplies = touchbook_vsim_supply, 190 - }; 191 - 192 - static struct twl4030_platform_data touchbook_twldata = { 193 - /* platform_data for children goes here */ 194 - .gpio = &touchbook_gpio_data, 195 - .vmmc1 = &touchbook_vmmc1, 196 - .vsim = &touchbook_vsim, 197 - }; 198 - 199 - static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = { 200 - { 201 - I2C_BOARD_INFO("bq27200", 0x55), 202 - }, 203 - }; 204 - 205 - static int __init omap3_touchbook_i2c_init(void) 206 - { 207 - /* Standard TouchBook bus */ 208 - omap3_pmic_get_config(&touchbook_twldata, 209 - TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO, 210 - TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2); 211 - 212 - touchbook_twldata.vdac->num_consumer_supplies = 213 - ARRAY_SIZE(touchbook_vdac_supply); 214 - touchbook_twldata.vdac->consumer_supplies = touchbook_vdac_supply; 215 - 216 - touchbook_twldata.vpll2->constraints.name = "VDVI"; 217 - touchbook_twldata.vpll2->num_consumer_supplies = 218 - ARRAY_SIZE(touchbook_vdvi_supply); 219 - touchbook_twldata.vpll2->consumer_supplies = touchbook_vdvi_supply; 220 - 221 - omap3_pmic_init("twl4030", &touchbook_twldata); 222 - /* Additional TouchBook bus */ 223 - omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo, 224 - ARRAY_SIZE(touchBook_i2c_boardinfo)); 225 - 226 - return 0; 227 - } 228 - 229 - static struct ads7846_platform_data ads7846_pdata = { 230 - .x_min = 100, 231 - .y_min = 265, 232 - .x_max = 3950, 233 - .y_max = 3750, 234 - .x_plate_ohms = 40, 235 - .pressure_max = 255, 236 - .debounce_max = 10, 237 - .debounce_tol = 5, 238 - .debounce_rep = 1, 239 - .gpio_pendown = OMAP3_TS_GPIO, 240 - .keep_vref_on = 1, 241 - }; 242 - 243 - static struct gpio_led gpio_leds[] = { 244 - { 245 - .name = "touchbook::usr0", 246 - .default_trigger = "heartbeat", 247 - .gpio = 150, 248 - }, 249 - { 250 - .name = "touchbook::usr1", 251 - .default_trigger = "mmc0", 252 - .gpio = 149, 253 - }, 254 - { 255 - .name = "touchbook::pmu_stat", 256 - .gpio = -EINVAL, /* gets replaced */ 257 - .active_low = true, 258 - }, 259 - }; 260 - 261 - static struct gpio_led_platform_data gpio_led_info = { 262 - .leds = gpio_leds, 263 - .num_leds = ARRAY_SIZE(gpio_leds), 264 - }; 265 - 266 - static struct platform_device leds_gpio = { 267 - .name = "leds-gpio", 268 - .id = -1, 269 - .dev = { 270 - .platform_data = &gpio_led_info, 271 - }, 272 - }; 273 - 274 - static struct gpio_keys_button gpio_buttons[] = { 275 - { 276 - .code = BTN_EXTRA, 277 - .gpio = 7, 278 - .desc = "user", 279 - .wakeup = 1, 280 - }, 281 - { 282 - .code = KEY_POWER, 283 - .gpio = 183, 284 - .desc = "power", 285 - .wakeup = 1, 286 - }, 287 - }; 288 - 289 - static struct gpio_keys_platform_data gpio_key_info = { 290 - .buttons = gpio_buttons, 291 - .nbuttons = ARRAY_SIZE(gpio_buttons), 292 - }; 293 - 294 - static struct platform_device keys_gpio = { 295 - .name = "gpio-keys", 296 - .id = -1, 297 - .dev = { 298 - .platform_data = &gpio_key_info, 299 - }, 300 - }; 301 - 302 - #ifdef CONFIG_OMAP_MUX 303 - static struct omap_board_mux board_mux[] __initdata = { 304 - { .reg_offset = OMAP_MUX_TERMINATOR }, 305 - }; 306 - #endif 307 - 308 - static struct usbhs_phy_data phy_data[] __initdata = { 309 - { 310 - .port = 2, 311 - .reset_gpio = 147, 312 - .vcc_gpio = -EINVAL, 313 - }, 314 - }; 315 - 316 - static struct platform_device *omap3_touchbook_devices[] __initdata = { 317 - &leds_gpio, 318 - &keys_gpio, 319 - }; 320 - 321 - static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 322 - .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 323 - .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 324 - }; 325 - 326 - static void omap3_touchbook_poweroff(void) 327 - { 328 - int pwr_off = TB_KILL_POWER_GPIO; 329 - 330 - if (gpio_request_one(pwr_off, GPIOF_OUT_INIT_LOW, "DVI reset") < 0) 331 - printk(KERN_ERR "Unable to get kill power GPIO\n"); 332 - } 333 - 334 - static int __init early_touchbook_revision(char *p) 335 - { 336 - if (!p) 337 - return 0; 338 - 339 - return kstrtoul(p, 10, &touchbook_revision); 340 - } 341 - early_param("tbr", early_touchbook_revision); 342 - 343 - static void __init omap3_touchbook_init(void) 344 - { 345 - omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 346 - 347 - pm_power_off = omap3_touchbook_poweroff; 348 - 349 - if (system_rev >= 0x20 && system_rev <= 0x34301000) { 350 - omap_mux_init_gpio(23, OMAP_PIN_INPUT); 351 - mmc[0].gpio_wp = 23; 352 - } else { 353 - omap_mux_init_gpio(29, OMAP_PIN_INPUT); 354 - } 355 - omap_hsmmc_init(mmc); 356 - 357 - omap3_touchbook_i2c_init(); 358 - platform_add_devices(omap3_touchbook_devices, 359 - ARRAY_SIZE(omap3_touchbook_devices)); 360 - omap_serial_init(); 361 - omap_sdrc_init(mt46h32m32lf6_sdrc_params, 362 - mt46h32m32lf6_sdrc_params); 363 - 364 - omap_mux_init_gpio(170, OMAP_PIN_INPUT); 365 - /* REVISIT leave DVI powered down until it's needed ... */ 366 - gpio_request_one(176, GPIOF_OUT_INIT_HIGH, "DVI_nPD"); 367 - 368 - /* Touchscreen and accelerometer */ 369 - omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); 370 - usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 371 - usb_musb_init(NULL); 372 - 373 - usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 374 - usbhs_init(&usbhs_bdata); 375 - board_nand_init(omap3touchbook_nand_partitions, 376 - ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS, 377 - NAND_BUSWIDTH_16, NULL); 378 - 379 - /* Ensure SDRC pins are mux'd for self-refresh */ 380 - omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 381 - omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); 382 - } 383 - 384 - MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board") 385 - /* Maintainer: Gregoire Gentil - http://www.alwaysinnovating.com */ 386 - .atag_offset = 0x100, 387 - .reserve = omap_reserve, 388 - .map_io = omap3_map_io, 389 - .init_early = omap3430_init_early, 390 - .init_irq = omap3_init_irq, 391 - .init_machine = omap3_touchbook_init, 392 - .init_late = omap3430_init_late, 393 - .init_time = omap3_secure_sync32k_timer_init, 394 - .restart = omap3xxx_restart, 395 - MACHINE_END
+3 -3
arch/arm/mach-shmobile/Makefile
··· 12 12 obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o pm-r8a7740.o 13 13 obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o 14 14 obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o 15 - obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o pm-r8a7790.o 16 - obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o pm-r8a7791.o 15 + obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o 16 + obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o 17 17 obj-$(CONFIG_ARCH_R8A7794) += setup-r8a7794.o 18 18 obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o 19 19 obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o ··· 46 46 47 47 # PM objects 48 48 obj-$(CONFIG_SUSPEND) += suspend.o 49 - obj-$(CONFIG_CPU_IDLE) += cpuidle.o 50 49 obj-$(CONFIG_CPU_FREQ) += cpufreq.o 51 50 obj-$(CONFIG_PM_RCAR) += pm-rcar.o 52 51 obj-$(CONFIG_PM_RMOBILE) += pm-rmobile.o 52 + obj-$(CONFIG_ARCH_RCAR_GEN2) += pm-rcar-gen2.o 53 53 54 54 # special sh7372 handling for IRQ objects and low level sleep code 55 55 obj-$(CONFIG_ARCH_SH7372) += entry-intc.o sleep-sh7372.o
-9
arch/arm/mach-shmobile/common.h
··· 23 23 extern int shmobile_clk_init(void); 24 24 extern void shmobile_handle_irq_intc(struct pt_regs *); 25 25 extern struct platform_suspend_ops shmobile_suspend_ops; 26 - struct cpuidle_driver; 27 - extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv); 28 26 29 27 #ifdef CONFIG_SUSPEND 30 28 int shmobile_suspend_init(void); ··· 30 32 #else 31 33 static inline int shmobile_suspend_init(void) { return 0; } 32 34 static inline void shmobile_smp_apmu_suspend_init(void) { } 33 - #endif 34 - 35 - #ifdef CONFIG_CPU_IDLE 36 - int shmobile_cpuidle_init(void); 37 - #else 38 - static inline int shmobile_cpuidle_init(void) { return 0; } 39 35 #endif 40 36 41 37 #ifdef CONFIG_CPU_FREQ ··· 43 51 static inline void __init shmobile_init_late(void) 44 52 { 45 53 shmobile_suspend_init(); 46 - shmobile_cpuidle_init(); 47 54 shmobile_cpufreq_init(); 48 55 } 49 56
-37
arch/arm/mach-shmobile/cpuidle.c
··· 1 - /* 2 - * CPUIdle support code for SH-Mobile ARM 3 - * 4 - * Copyright (C) 2011 Magnus Damm 5 - * 6 - * This file is subject to the terms and conditions of the GNU General Public 7 - * License. See the file "COPYING" in the main directory of this archive 8 - * for more details. 9 - */ 10 - 11 - #include <linux/pm.h> 12 - #include <linux/cpuidle.h> 13 - #include <linux/suspend.h> 14 - #include <linux/module.h> 15 - #include <linux/err.h> 16 - #include <asm/cpuidle.h> 17 - #include <asm/io.h> 18 - 19 - static struct cpuidle_driver shmobile_cpuidle_default_driver = { 20 - .name = "shmobile_cpuidle", 21 - .owner = THIS_MODULE, 22 - .states[0] = ARM_CPUIDLE_WFI_STATE, 23 - .safe_state_index = 0, /* C1 */ 24 - .state_count = 1, 25 - }; 26 - 27 - static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver; 28 - 29 - void __init shmobile_cpuidle_set_driver(struct cpuidle_driver *drv) 30 - { 31 - cpuidle_drv = drv; 32 - } 33 - 34 - int __init shmobile_cpuidle_init(void) 35 - { 36 - return cpuidle_register(cpuidle_drv, NULL); 37 - }
-82
arch/arm/mach-shmobile/pm-r8a7790.c
··· 1 - /* 2 - * r8a7790 Power management support 3 - * 4 - * Copyright (C) 2013 Renesas Electronics Corporation 5 - * Copyright (C) 2011 Renesas Solutions Corp. 6 - * Copyright (C) 2011 Magnus Damm 7 - * 8 - * This file is subject to the terms and conditions of the GNU General Public 9 - * License. See the file "COPYING" in the main directory of this archive 10 - * for more details. 11 - */ 12 - 13 - #include <linux/kernel.h> 14 - #include <linux/smp.h> 15 - #include <asm/io.h> 16 - #include "common.h" 17 - #include "pm-rcar.h" 18 - #include "r8a7790.h" 19 - 20 - /* RST */ 21 - #define RST 0xe6160000 22 - #define CA15BAR 0x0020 23 - #define CA7BAR 0x0030 24 - #define CA15RESCNT 0x0040 25 - #define CA7RESCNT 0x0044 26 - 27 - /* On-chip RAM */ 28 - #define MERAM 0xe8080000 29 - 30 - /* SYSC */ 31 - #define SYSCIER 0x0c 32 - #define SYSCIMR 0x10 33 - 34 - #if defined(CONFIG_SMP) 35 - 36 - static void __init r8a7790_sysc_init(void) 37 - { 38 - void __iomem *base = rcar_sysc_init(0xe6180000); 39 - 40 - /* enable all interrupt sources, but do not use interrupt handler */ 41 - iowrite32(0x0131000e, base + SYSCIER); 42 - iowrite32(0, base + SYSCIMR); 43 - } 44 - 45 - #else /* CONFIG_SMP */ 46 - 47 - static inline void r8a7790_sysc_init(void) {} 48 - 49 - #endif /* CONFIG_SMP */ 50 - 51 - void __init r8a7790_pm_init(void) 52 - { 53 - void __iomem *p; 54 - u32 bar; 55 - static int once; 56 - 57 - if (once++) 58 - return; 59 - 60 - /* MERAM for jump stub, because BAR requires 256KB aligned address */ 61 - p = ioremap_nocache(MERAM, shmobile_boot_size); 62 - memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size); 63 - iounmap(p); 64 - 65 - /* setup reset vectors */ 66 - p = ioremap_nocache(RST, 0x63); 67 - bar = (MERAM >> 8) & 0xfffffc00; 68 - writel_relaxed(bar, p + CA15BAR); 69 - writel_relaxed(bar, p + CA7BAR); 70 - writel_relaxed(bar | 0x10, p + CA15BAR); 71 - writel_relaxed(bar | 0x10, p + CA7BAR); 72 - 73 - /* de-assert reset for all CPUs */ 74 - writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000, 75 - p + CA15RESCNT); 76 - writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000, 77 - p + CA7RESCNT); 78 - iounmap(p); 79 - 80 - r8a7790_sysc_init(); 81 - shmobile_smp_apmu_suspend_init(); 82 - }
-73
arch/arm/mach-shmobile/pm-r8a7791.c
··· 1 - /* 2 - * r8a7791 Power management support 3 - * 4 - * Copyright (C) 2014 Renesas Electronics Corporation 5 - * Copyright (C) 2011 Renesas Solutions Corp. 6 - * Copyright (C) 2011 Magnus Damm 7 - * 8 - * This file is subject to the terms and conditions of the GNU General Public 9 - * License. See the file "COPYING" in the main directory of this archive 10 - * for more details. 11 - */ 12 - 13 - #include <linux/kernel.h> 14 - #include <linux/smp.h> 15 - #include <asm/io.h> 16 - #include "common.h" 17 - #include "pm-rcar.h" 18 - #include "r8a7791.h" 19 - 20 - #define RST 0xe6160000 21 - #define CA15BAR 0x0020 22 - #define CA15RESCNT 0x0040 23 - #define RAM 0xe6300000 24 - 25 - /* SYSC */ 26 - #define SYSCIER 0x0c 27 - #define SYSCIMR 0x10 28 - 29 - #if defined(CONFIG_SMP) 30 - 31 - static void __init r8a7791_sysc_init(void) 32 - { 33 - void __iomem *base = rcar_sysc_init(0xe6180000); 34 - 35 - /* enable all interrupt sources, but do not use interrupt handler */ 36 - iowrite32(0x0131000e, base + SYSCIER); 37 - iowrite32(0, base + SYSCIMR); 38 - } 39 - 40 - #else /* CONFIG_SMP */ 41 - 42 - static inline void r8a7791_sysc_init(void) {} 43 - 44 - #endif /* CONFIG_SMP */ 45 - 46 - void __init r8a7791_pm_init(void) 47 - { 48 - void __iomem *p; 49 - u32 bar; 50 - static int once; 51 - 52 - if (once++) 53 - return; 54 - 55 - /* RAM for jump stub, because BAR requires 256KB aligned address */ 56 - p = ioremap_nocache(RAM, shmobile_boot_size); 57 - memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size); 58 - iounmap(p); 59 - 60 - /* setup reset vectors */ 61 - p = ioremap_nocache(RST, 0x63); 62 - bar = (RAM >> 8) & 0xfffffc00; 63 - writel_relaxed(bar, p + CA15BAR); 64 - writel_relaxed(bar | 0x10, p + CA15BAR); 65 - 66 - /* enable clocks to all CPUs */ 67 - writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000, 68 - p + CA15RESCNT); 69 - iounmap(p); 70 - 71 - r8a7791_sysc_init(); 72 - shmobile_smp_apmu_suspend_init(); 73 - }
+115
arch/arm/mach-shmobile/pm-rcar-gen2.c
··· 1 + /* 2 + * R-Car Generation 2 Power management support 3 + * 4 + * Copyright (C) 2013 - 2015 Renesas Electronics Corporation 5 + * Copyright (C) 2011 Renesas Solutions Corp. 6 + * Copyright (C) 2011 Magnus Damm 7 + * 8 + * This file is subject to the terms and conditions of the GNU General Public 9 + * License. See the file "COPYING" in the main directory of this archive 10 + * for more details. 11 + */ 12 + 13 + #include <linux/kernel.h> 14 + #include <linux/of.h> 15 + #include <linux/smp.h> 16 + #include <asm/io.h> 17 + #include "common.h" 18 + #include "pm-rcar.h" 19 + #include "rcar-gen2.h" 20 + 21 + /* RST */ 22 + #define RST 0xe6160000 23 + #define CA15BAR 0x0020 24 + #define CA7BAR 0x0030 25 + #define CA15RESCNT 0x0040 26 + #define CA7RESCNT 0x0044 27 + 28 + /* On-chip RAM */ 29 + #define MERAM 0xe8080000 30 + #define RAM 0xe6300000 31 + 32 + /* SYSC */ 33 + #define SYSCIER 0x0c 34 + #define SYSCIMR 0x10 35 + 36 + #if defined(CONFIG_SMP) 37 + 38 + static void __init rcar_gen2_sysc_init(u32 syscier) 39 + { 40 + void __iomem *base = rcar_sysc_init(0xe6180000); 41 + 42 + /* enable all interrupt sources, but do not use interrupt handler */ 43 + iowrite32(syscier, base + SYSCIER); 44 + iowrite32(0, base + SYSCIMR); 45 + } 46 + 47 + #else /* CONFIG_SMP */ 48 + 49 + static inline void rcar_gen2_sysc_init(u32 syscier) {} 50 + 51 + #endif /* CONFIG_SMP */ 52 + 53 + void __init rcar_gen2_pm_init(void) 54 + { 55 + void __iomem *p; 56 + u32 bar; 57 + static int once; 58 + struct device_node *np, *cpus; 59 + bool has_a7 = false; 60 + bool has_a15 = false; 61 + phys_addr_t boot_vector_addr = 0; 62 + u32 syscier = 0; 63 + 64 + if (once++) 65 + return; 66 + 67 + cpus = of_find_node_by_path("/cpus"); 68 + if (!cpus) 69 + return; 70 + 71 + for_each_child_of_node(cpus, np) { 72 + if (of_device_is_compatible(np, "arm,cortex-a15")) 73 + has_a15 = true; 74 + else if (of_device_is_compatible(np, "arm,cortex-a7")) 75 + has_a7 = true; 76 + } 77 + 78 + if (of_machine_is_compatible("renesas,r8a7790")) { 79 + boot_vector_addr = MERAM; 80 + syscier = 0x013111ef; 81 + 82 + } else if (of_machine_is_compatible("renesas,r8a7791")) { 83 + boot_vector_addr = RAM; 84 + syscier = 0x00111003; 85 + } 86 + 87 + /* RAM for jump stub, because BAR requires 256KB aligned address */ 88 + p = ioremap_nocache(boot_vector_addr, shmobile_boot_size); 89 + memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size); 90 + iounmap(p); 91 + 92 + /* setup reset vectors */ 93 + p = ioremap_nocache(RST, 0x63); 94 + bar = (boot_vector_addr >> 8) & 0xfffffc00; 95 + if (has_a15) { 96 + writel_relaxed(bar, p + CA15BAR); 97 + writel_relaxed(bar | 0x10, p + CA15BAR); 98 + 99 + /* de-assert reset for CA15 CPUs */ 100 + writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 101 + 0xa5a50000, p + CA15RESCNT); 102 + } 103 + if (has_a7) { 104 + writel_relaxed(bar, p + CA7BAR); 105 + writel_relaxed(bar | 0x10, p + CA7BAR); 106 + 107 + /* de-assert reset for CA7 CPUs */ 108 + writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 109 + 0x5a5a0000, p + CA7RESCNT); 110 + } 111 + iounmap(p); 112 + 113 + rcar_gen2_sysc_init(syscier); 114 + shmobile_smp_apmu_suspend_init(); 115 + }
+1 -1
arch/arm/mach-shmobile/pm-sh7372.c
··· 462 462 463 463 static void __init sh7372_cpuidle_init(void) 464 464 { 465 - shmobile_cpuidle_set_driver(&sh7372_cpuidle_driver); 465 + return cpuidle_register(cpuidle_drv, NULL); 466 466 } 467 467 #else 468 468 static void __init sh7372_cpuidle_init(void) {}
-1
arch/arm/mach-shmobile/r8a7790.h
··· 1 1 #ifndef __ASM_R8A7790_H__ 2 2 #define __ASM_R8A7790_H__ 3 3 4 - void r8a7790_pm_init(void); 5 4 extern struct smp_operations r8a7790_smp_ops; 6 5 7 6 #endif /* __ASM_R8A7790_H__ */
-1
arch/arm/mach-shmobile/r8a7791.h
··· 1 1 #ifndef __ASM_R8A7791_H__ 2 2 #define __ASM_R8A7791_H__ 3 3 4 - void r8a7791_pm_init(void); 5 4 extern struct smp_operations r8a7791_smp_ops; 6 5 7 6 #endif /* __ASM_R8A7791_H__ */
+1
arch/arm/mach-shmobile/rcar-gen2.h
··· 5 5 #define MD(nr) BIT(nr) 6 6 u32 rcar_gen2_read_mode_pins(void); 7 7 void rcar_gen2_reserve(void); 8 + void rcar_gen2_pm_init(void); 8 9 9 10 #endif /* __ASM_RCAR_GEN2_H__ */
-8
arch/arm/mach-shmobile/setup-r8a7740.c
··· 842 842 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 843 843 } 844 844 845 - #define RESCNT2 IOMEM(0xe6188020) 846 - static void r8a7740_restart(enum reboot_mode mode, const char *cmd) 847 - { 848 - /* Do soft power on reset */ 849 - writel(1 << 31, RESCNT2); 850 - } 851 - 852 845 static const char *r8a7740_boards_compat_dt[] __initdata = { 853 846 "renesas,r8a7740", 854 847 NULL, ··· 854 861 .init_machine = r8a7740_generic_init, 855 862 .init_late = shmobile_init_late, 856 863 .dt_compat = r8a7740_boards_compat_dt, 857 - .restart = r8a7740_restart, 858 864 MACHINE_END 859 865 860 866 #endif /* CONFIG_USE_OF */
-4
arch/arm/mach-shmobile/setup-rcar-gen2.c
··· 50 50 51 51 void __init rcar_gen2_timer_init(void) 52 52 { 53 - #if defined(CONFIG_ARM_ARCH_TIMER) || defined(CONFIG_COMMON_CLK) 54 53 u32 mode = rcar_gen2_read_mode_pins(); 55 - #endif 56 54 #ifdef CONFIG_ARM_ARCH_TIMER 57 55 void __iomem *base; 58 56 int extal_mhz = 0; ··· 126 128 iounmap(base); 127 129 #endif /* CONFIG_ARM_ARCH_TIMER */ 128 130 129 - #ifdef CONFIG_COMMON_CLK 130 131 rcar_gen2_clocks_init(mode); 131 - #endif 132 132 #ifdef CONFIG_ARCH_SHMOBILE_MULTI 133 133 clocksource_of_init(); 134 134 #endif
+2 -1
arch/arm/mach-shmobile/smp-r8a7790.c
··· 23 23 #include "common.h" 24 24 #include "platsmp-apmu.h" 25 25 #include "pm-rcar.h" 26 + #include "rcar-gen2.h" 26 27 #include "r8a7790.h" 27 28 28 29 static struct rcar_sysc_ch r8a7790_ca15_scu = { ··· 55 54 ARRAY_SIZE(r8a7790_apmu_config)); 56 55 57 56 /* turn on power to SCU */ 58 - r8a7790_pm_init(); 57 + rcar_gen2_pm_init(); 59 58 rcar_sysc_power_up(&r8a7790_ca15_scu); 60 59 rcar_sysc_power_up(&r8a7790_ca7_scu); 61 60 }
+1 -1
arch/arm/mach-shmobile/smp-r8a7791.c
··· 39 39 r8a7791_apmu_config, 40 40 ARRAY_SIZE(r8a7791_apmu_config)); 41 41 42 - r8a7791_pm_init(); 42 + rcar_gen2_pm_init(); 43 43 } 44 44 45 45 static int r8a7791_smp_boot_secondary(unsigned int cpu,
-8
drivers/gpio/Kconfig
··· 272 272 Say Y here if you're going to use hardware that connects to the 273 273 MPC512x/831x/834x/837x/8572/8610 GPIOs. 274 274 275 - config GPIO_MSM_V1 276 - tristate "Qualcomm MSM GPIO v1" 277 - depends on GPIOLIB && ARCH_MSM && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50) 278 - help 279 - Say yes here to support the GPIO interface on ARM v6 based 280 - Qualcomm MSM chips. Most of the pins on the MSM can be 281 - selected for GPIO, and are controlled by this driver. 282 - 283 275 config GPIO_MSM_V2 284 276 tristate "Qualcomm MSM GPIO v2" 285 277 depends on GPIOLIB && OF && ARCH_QCOM
-1
drivers/gpio/Makefile
··· 60 60 obj-$(CONFIG_GPIO_MPC5200) += gpio-mpc5200.o 61 61 obj-$(CONFIG_GPIO_MPC8XXX) += gpio-mpc8xxx.o 62 62 obj-$(CONFIG_GPIO_MSIC) += gpio-msic.o 63 - obj-$(CONFIG_GPIO_MSM_V1) += gpio-msm-v1.o 64 63 obj-$(CONFIG_GPIO_MSM_V2) += gpio-msm-v2.o 65 64 obj-$(CONFIG_GPIO_MVEBU) += gpio-mvebu.o 66 65 obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o
-714
drivers/gpio/gpio-msm-v1.c
··· 1 - /* 2 - * Copyright (C) 2007 Google, Inc. 3 - * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. 4 - * 5 - * This software is licensed under the terms of the GNU General Public 6 - * License version 2, as published by the Free Software Foundation, and 7 - * may be copied, distributed, and modified under those terms. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - */ 15 - 16 - #include <linux/bitops.h> 17 - #include <linux/gpio.h> 18 - #include <linux/interrupt.h> 19 - #include <linux/io.h> 20 - #include <linux/irq.h> 21 - #include <linux/module.h> 22 - #include <linux/device.h> 23 - #include <linux/platform_device.h> 24 - #include <linux/err.h> 25 - 26 - #include <mach/msm_gpiomux.h> 27 - 28 - /* see 80-VA736-2 Rev C pp 695-751 29 - ** 30 - ** These are actually the *shadow* gpio registers, since the 31 - ** real ones (which allow full access) are only available to the 32 - ** ARM9 side of the world. 33 - ** 34 - ** Since the _BASE need to be page-aligned when we're mapping them 35 - ** to virtual addresses, adjust for the additional offset in these 36 - ** macros. 37 - */ 38 - 39 - #define MSM_GPIO1_REG(off) (off) 40 - #define MSM_GPIO2_REG(off) (off) 41 - #define MSM_GPIO1_SHADOW_REG(off) (off) 42 - #define MSM_GPIO2_SHADOW_REG(off) (off) 43 - 44 - /* 45 - * MSM7X00 registers 46 - */ 47 - /* output value */ 48 - #define MSM7X00_GPIO_OUT_0 MSM_GPIO1_SHADOW_REG(0x00) /* gpio 15-0 */ 49 - #define MSM7X00_GPIO_OUT_1 MSM_GPIO2_SHADOW_REG(0x00) /* gpio 42-16 */ 50 - #define MSM7X00_GPIO_OUT_2 MSM_GPIO1_SHADOW_REG(0x04) /* gpio 67-43 */ 51 - #define MSM7X00_GPIO_OUT_3 MSM_GPIO1_SHADOW_REG(0x08) /* gpio 94-68 */ 52 - #define MSM7X00_GPIO_OUT_4 MSM_GPIO1_SHADOW_REG(0x0C) /* gpio 106-95 */ 53 - #define MSM7X00_GPIO_OUT_5 MSM_GPIO1_SHADOW_REG(0x50) /* gpio 107-121 */ 54 - 55 - /* same pin map as above, output enable */ 56 - #define MSM7X00_GPIO_OE_0 MSM_GPIO1_SHADOW_REG(0x10) 57 - #define MSM7X00_GPIO_OE_1 MSM_GPIO2_SHADOW_REG(0x08) 58 - #define MSM7X00_GPIO_OE_2 MSM_GPIO1_SHADOW_REG(0x14) 59 - #define MSM7X00_GPIO_OE_3 MSM_GPIO1_SHADOW_REG(0x18) 60 - #define MSM7X00_GPIO_OE_4 MSM_GPIO1_SHADOW_REG(0x1C) 61 - #define MSM7X00_GPIO_OE_5 MSM_GPIO1_SHADOW_REG(0x54) 62 - 63 - /* same pin map as above, input read */ 64 - #define MSM7X00_GPIO_IN_0 MSM_GPIO1_SHADOW_REG(0x34) 65 - #define MSM7X00_GPIO_IN_1 MSM_GPIO2_SHADOW_REG(0x20) 66 - #define MSM7X00_GPIO_IN_2 MSM_GPIO1_SHADOW_REG(0x38) 67 - #define MSM7X00_GPIO_IN_3 MSM_GPIO1_SHADOW_REG(0x3C) 68 - #define MSM7X00_GPIO_IN_4 MSM_GPIO1_SHADOW_REG(0x40) 69 - #define MSM7X00_GPIO_IN_5 MSM_GPIO1_SHADOW_REG(0x44) 70 - 71 - /* same pin map as above, 1=edge 0=level interrup */ 72 - #define MSM7X00_GPIO_INT_EDGE_0 MSM_GPIO1_SHADOW_REG(0x60) 73 - #define MSM7X00_GPIO_INT_EDGE_1 MSM_GPIO2_SHADOW_REG(0x50) 74 - #define MSM7X00_GPIO_INT_EDGE_2 MSM_GPIO1_SHADOW_REG(0x64) 75 - #define MSM7X00_GPIO_INT_EDGE_3 MSM_GPIO1_SHADOW_REG(0x68) 76 - #define MSM7X00_GPIO_INT_EDGE_4 MSM_GPIO1_SHADOW_REG(0x6C) 77 - #define MSM7X00_GPIO_INT_EDGE_5 MSM_GPIO1_SHADOW_REG(0xC0) 78 - 79 - /* same pin map as above, 1=positive 0=negative */ 80 - #define MSM7X00_GPIO_INT_POS_0 MSM_GPIO1_SHADOW_REG(0x70) 81 - #define MSM7X00_GPIO_INT_POS_1 MSM_GPIO2_SHADOW_REG(0x58) 82 - #define MSM7X00_GPIO_INT_POS_2 MSM_GPIO1_SHADOW_REG(0x74) 83 - #define MSM7X00_GPIO_INT_POS_3 MSM_GPIO1_SHADOW_REG(0x78) 84 - #define MSM7X00_GPIO_INT_POS_4 MSM_GPIO1_SHADOW_REG(0x7C) 85 - #define MSM7X00_GPIO_INT_POS_5 MSM_GPIO1_SHADOW_REG(0xBC) 86 - 87 - /* same pin map as above, interrupt enable */ 88 - #define MSM7X00_GPIO_INT_EN_0 MSM_GPIO1_SHADOW_REG(0x80) 89 - #define MSM7X00_GPIO_INT_EN_1 MSM_GPIO2_SHADOW_REG(0x60) 90 - #define MSM7X00_GPIO_INT_EN_2 MSM_GPIO1_SHADOW_REG(0x84) 91 - #define MSM7X00_GPIO_INT_EN_3 MSM_GPIO1_SHADOW_REG(0x88) 92 - #define MSM7X00_GPIO_INT_EN_4 MSM_GPIO1_SHADOW_REG(0x8C) 93 - #define MSM7X00_GPIO_INT_EN_5 MSM_GPIO1_SHADOW_REG(0xB8) 94 - 95 - /* same pin map as above, write 1 to clear interrupt */ 96 - #define MSM7X00_GPIO_INT_CLEAR_0 MSM_GPIO1_SHADOW_REG(0x90) 97 - #define MSM7X00_GPIO_INT_CLEAR_1 MSM_GPIO2_SHADOW_REG(0x68) 98 - #define MSM7X00_GPIO_INT_CLEAR_2 MSM_GPIO1_SHADOW_REG(0x94) 99 - #define MSM7X00_GPIO_INT_CLEAR_3 MSM_GPIO1_SHADOW_REG(0x98) 100 - #define MSM7X00_GPIO_INT_CLEAR_4 MSM_GPIO1_SHADOW_REG(0x9C) 101 - #define MSM7X00_GPIO_INT_CLEAR_5 MSM_GPIO1_SHADOW_REG(0xB4) 102 - 103 - /* same pin map as above, 1=interrupt pending */ 104 - #define MSM7X00_GPIO_INT_STATUS_0 MSM_GPIO1_SHADOW_REG(0xA0) 105 - #define MSM7X00_GPIO_INT_STATUS_1 MSM_GPIO2_SHADOW_REG(0x70) 106 - #define MSM7X00_GPIO_INT_STATUS_2 MSM_GPIO1_SHADOW_REG(0xA4) 107 - #define MSM7X00_GPIO_INT_STATUS_3 MSM_GPIO1_SHADOW_REG(0xA8) 108 - #define MSM7X00_GPIO_INT_STATUS_4 MSM_GPIO1_SHADOW_REG(0xAC) 109 - #define MSM7X00_GPIO_INT_STATUS_5 MSM_GPIO1_SHADOW_REG(0xB0) 110 - 111 - /* 112 - * QSD8X50 registers 113 - */ 114 - /* output value */ 115 - #define QSD8X50_GPIO_OUT_0 MSM_GPIO1_SHADOW_REG(0x00) /* gpio 15-0 */ 116 - #define QSD8X50_GPIO_OUT_1 MSM_GPIO2_SHADOW_REG(0x00) /* gpio 42-16 */ 117 - #define QSD8X50_GPIO_OUT_2 MSM_GPIO1_SHADOW_REG(0x04) /* gpio 67-43 */ 118 - #define QSD8X50_GPIO_OUT_3 MSM_GPIO1_SHADOW_REG(0x08) /* gpio 94-68 */ 119 - #define QSD8X50_GPIO_OUT_4 MSM_GPIO1_SHADOW_REG(0x0C) /* gpio 103-95 */ 120 - #define QSD8X50_GPIO_OUT_5 MSM_GPIO1_SHADOW_REG(0x10) /* gpio 121-104 */ 121 - #define QSD8X50_GPIO_OUT_6 MSM_GPIO1_SHADOW_REG(0x14) /* gpio 152-122 */ 122 - #define QSD8X50_GPIO_OUT_7 MSM_GPIO1_SHADOW_REG(0x18) /* gpio 164-153 */ 123 - 124 - /* same pin map as above, output enable */ 125 - #define QSD8X50_GPIO_OE_0 MSM_GPIO1_SHADOW_REG(0x20) 126 - #define QSD8X50_GPIO_OE_1 MSM_GPIO2_SHADOW_REG(0x08) 127 - #define QSD8X50_GPIO_OE_2 MSM_GPIO1_SHADOW_REG(0x24) 128 - #define QSD8X50_GPIO_OE_3 MSM_GPIO1_SHADOW_REG(0x28) 129 - #define QSD8X50_GPIO_OE_4 MSM_GPIO1_SHADOW_REG(0x2C) 130 - #define QSD8X50_GPIO_OE_5 MSM_GPIO1_SHADOW_REG(0x30) 131 - #define QSD8X50_GPIO_OE_6 MSM_GPIO1_SHADOW_REG(0x34) 132 - #define QSD8X50_GPIO_OE_7 MSM_GPIO1_SHADOW_REG(0x38) 133 - 134 - /* same pin map as above, input read */ 135 - #define QSD8X50_GPIO_IN_0 MSM_GPIO1_SHADOW_REG(0x50) 136 - #define QSD8X50_GPIO_IN_1 MSM_GPIO2_SHADOW_REG(0x20) 137 - #define QSD8X50_GPIO_IN_2 MSM_GPIO1_SHADOW_REG(0x54) 138 - #define QSD8X50_GPIO_IN_3 MSM_GPIO1_SHADOW_REG(0x58) 139 - #define QSD8X50_GPIO_IN_4 MSM_GPIO1_SHADOW_REG(0x5C) 140 - #define QSD8X50_GPIO_IN_5 MSM_GPIO1_SHADOW_REG(0x60) 141 - #define QSD8X50_GPIO_IN_6 MSM_GPIO1_SHADOW_REG(0x64) 142 - #define QSD8X50_GPIO_IN_7 MSM_GPIO1_SHADOW_REG(0x68) 143 - 144 - /* same pin map as above, 1=edge 0=level interrup */ 145 - #define QSD8X50_GPIO_INT_EDGE_0 MSM_GPIO1_SHADOW_REG(0x70) 146 - #define QSD8X50_GPIO_INT_EDGE_1 MSM_GPIO2_SHADOW_REG(0x50) 147 - #define QSD8X50_GPIO_INT_EDGE_2 MSM_GPIO1_SHADOW_REG(0x74) 148 - #define QSD8X50_GPIO_INT_EDGE_3 MSM_GPIO1_SHADOW_REG(0x78) 149 - #define QSD8X50_GPIO_INT_EDGE_4 MSM_GPIO1_SHADOW_REG(0x7C) 150 - #define QSD8X50_GPIO_INT_EDGE_5 MSM_GPIO1_SHADOW_REG(0x80) 151 - #define QSD8X50_GPIO_INT_EDGE_6 MSM_GPIO1_SHADOW_REG(0x84) 152 - #define QSD8X50_GPIO_INT_EDGE_7 MSM_GPIO1_SHADOW_REG(0x88) 153 - 154 - /* same pin map as above, 1=positive 0=negative */ 155 - #define QSD8X50_GPIO_INT_POS_0 MSM_GPIO1_SHADOW_REG(0x90) 156 - #define QSD8X50_GPIO_INT_POS_1 MSM_GPIO2_SHADOW_REG(0x58) 157 - #define QSD8X50_GPIO_INT_POS_2 MSM_GPIO1_SHADOW_REG(0x94) 158 - #define QSD8X50_GPIO_INT_POS_3 MSM_GPIO1_SHADOW_REG(0x98) 159 - #define QSD8X50_GPIO_INT_POS_4 MSM_GPIO1_SHADOW_REG(0x9C) 160 - #define QSD8X50_GPIO_INT_POS_5 MSM_GPIO1_SHADOW_REG(0xA0) 161 - #define QSD8X50_GPIO_INT_POS_6 MSM_GPIO1_SHADOW_REG(0xA4) 162 - #define QSD8X50_GPIO_INT_POS_7 MSM_GPIO1_SHADOW_REG(0xA8) 163 - 164 - /* same pin map as above, interrupt enable */ 165 - #define QSD8X50_GPIO_INT_EN_0 MSM_GPIO1_SHADOW_REG(0xB0) 166 - #define QSD8X50_GPIO_INT_EN_1 MSM_GPIO2_SHADOW_REG(0x60) 167 - #define QSD8X50_GPIO_INT_EN_2 MSM_GPIO1_SHADOW_REG(0xB4) 168 - #define QSD8X50_GPIO_INT_EN_3 MSM_GPIO1_SHADOW_REG(0xB8) 169 - #define QSD8X50_GPIO_INT_EN_4 MSM_GPIO1_SHADOW_REG(0xBC) 170 - #define QSD8X50_GPIO_INT_EN_5 MSM_GPIO1_SHADOW_REG(0xC0) 171 - #define QSD8X50_GPIO_INT_EN_6 MSM_GPIO1_SHADOW_REG(0xC4) 172 - #define QSD8X50_GPIO_INT_EN_7 MSM_GPIO1_SHADOW_REG(0xC8) 173 - 174 - /* same pin map as above, write 1 to clear interrupt */ 175 - #define QSD8X50_GPIO_INT_CLEAR_0 MSM_GPIO1_SHADOW_REG(0xD0) 176 - #define QSD8X50_GPIO_INT_CLEAR_1 MSM_GPIO2_SHADOW_REG(0x68) 177 - #define QSD8X50_GPIO_INT_CLEAR_2 MSM_GPIO1_SHADOW_REG(0xD4) 178 - #define QSD8X50_GPIO_INT_CLEAR_3 MSM_GPIO1_SHADOW_REG(0xD8) 179 - #define QSD8X50_GPIO_INT_CLEAR_4 MSM_GPIO1_SHADOW_REG(0xDC) 180 - #define QSD8X50_GPIO_INT_CLEAR_5 MSM_GPIO1_SHADOW_REG(0xE0) 181 - #define QSD8X50_GPIO_INT_CLEAR_6 MSM_GPIO1_SHADOW_REG(0xE4) 182 - #define QSD8X50_GPIO_INT_CLEAR_7 MSM_GPIO1_SHADOW_REG(0xE8) 183 - 184 - /* same pin map as above, 1=interrupt pending */ 185 - #define QSD8X50_GPIO_INT_STATUS_0 MSM_GPIO1_SHADOW_REG(0xF0) 186 - #define QSD8X50_GPIO_INT_STATUS_1 MSM_GPIO2_SHADOW_REG(0x70) 187 - #define QSD8X50_GPIO_INT_STATUS_2 MSM_GPIO1_SHADOW_REG(0xF4) 188 - #define QSD8X50_GPIO_INT_STATUS_3 MSM_GPIO1_SHADOW_REG(0xF8) 189 - #define QSD8X50_GPIO_INT_STATUS_4 MSM_GPIO1_SHADOW_REG(0xFC) 190 - #define QSD8X50_GPIO_INT_STATUS_5 MSM_GPIO1_SHADOW_REG(0x100) 191 - #define QSD8X50_GPIO_INT_STATUS_6 MSM_GPIO1_SHADOW_REG(0x104) 192 - #define QSD8X50_GPIO_INT_STATUS_7 MSM_GPIO1_SHADOW_REG(0x108) 193 - 194 - /* 195 - * MSM7X30 registers 196 - */ 197 - /* output value */ 198 - #define MSM7X30_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */ 199 - #define MSM7X30_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 43-16 */ 200 - #define MSM7X30_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-44 */ 201 - #define MSM7X30_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */ 202 - #define MSM7X30_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 106-95 */ 203 - #define MSM7X30_GPIO_OUT_5 MSM_GPIO1_REG(0x50) /* gpio 133-107 */ 204 - #define MSM7X30_GPIO_OUT_6 MSM_GPIO1_REG(0xC4) /* gpio 150-134 */ 205 - #define MSM7X30_GPIO_OUT_7 MSM_GPIO1_REG(0x214) /* gpio 181-151 */ 206 - 207 - /* same pin map as above, output enable */ 208 - #define MSM7X30_GPIO_OE_0 MSM_GPIO1_REG(0x10) 209 - #define MSM7X30_GPIO_OE_1 MSM_GPIO2_REG(0x08) 210 - #define MSM7X30_GPIO_OE_2 MSM_GPIO1_REG(0x14) 211 - #define MSM7X30_GPIO_OE_3 MSM_GPIO1_REG(0x18) 212 - #define MSM7X30_GPIO_OE_4 MSM_GPIO1_REG(0x1C) 213 - #define MSM7X30_GPIO_OE_5 MSM_GPIO1_REG(0x54) 214 - #define MSM7X30_GPIO_OE_6 MSM_GPIO1_REG(0xC8) 215 - #define MSM7X30_GPIO_OE_7 MSM_GPIO1_REG(0x218) 216 - 217 - /* same pin map as above, input read */ 218 - #define MSM7X30_GPIO_IN_0 MSM_GPIO1_REG(0x34) 219 - #define MSM7X30_GPIO_IN_1 MSM_GPIO2_REG(0x20) 220 - #define MSM7X30_GPIO_IN_2 MSM_GPIO1_REG(0x38) 221 - #define MSM7X30_GPIO_IN_3 MSM_GPIO1_REG(0x3C) 222 - #define MSM7X30_GPIO_IN_4 MSM_GPIO1_REG(0x40) 223 - #define MSM7X30_GPIO_IN_5 MSM_GPIO1_REG(0x44) 224 - #define MSM7X30_GPIO_IN_6 MSM_GPIO1_REG(0xCC) 225 - #define MSM7X30_GPIO_IN_7 MSM_GPIO1_REG(0x21C) 226 - 227 - /* same pin map as above, 1=edge 0=level interrup */ 228 - #define MSM7X30_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x60) 229 - #define MSM7X30_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50) 230 - #define MSM7X30_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x64) 231 - #define MSM7X30_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x68) 232 - #define MSM7X30_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x6C) 233 - #define MSM7X30_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0xC0) 234 - #define MSM7X30_GPIO_INT_EDGE_6 MSM_GPIO1_REG(0xD0) 235 - #define MSM7X30_GPIO_INT_EDGE_7 MSM_GPIO1_REG(0x240) 236 - 237 - /* same pin map as above, 1=positive 0=negative */ 238 - #define MSM7X30_GPIO_INT_POS_0 MSM_GPIO1_REG(0x70) 239 - #define MSM7X30_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58) 240 - #define MSM7X30_GPIO_INT_POS_2 MSM_GPIO1_REG(0x74) 241 - #define MSM7X30_GPIO_INT_POS_3 MSM_GPIO1_REG(0x78) 242 - #define MSM7X30_GPIO_INT_POS_4 MSM_GPIO1_REG(0x7C) 243 - #define MSM7X30_GPIO_INT_POS_5 MSM_GPIO1_REG(0xBC) 244 - #define MSM7X30_GPIO_INT_POS_6 MSM_GPIO1_REG(0xD4) 245 - #define MSM7X30_GPIO_INT_POS_7 MSM_GPIO1_REG(0x228) 246 - 247 - /* same pin map as above, interrupt enable */ 248 - #define MSM7X30_GPIO_INT_EN_0 MSM_GPIO1_REG(0x80) 249 - #define MSM7X30_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60) 250 - #define MSM7X30_GPIO_INT_EN_2 MSM_GPIO1_REG(0x84) 251 - #define MSM7X30_GPIO_INT_EN_3 MSM_GPIO1_REG(0x88) 252 - #define MSM7X30_GPIO_INT_EN_4 MSM_GPIO1_REG(0x8C) 253 - #define MSM7X30_GPIO_INT_EN_5 MSM_GPIO1_REG(0xB8) 254 - #define MSM7X30_GPIO_INT_EN_6 MSM_GPIO1_REG(0xD8) 255 - #define MSM7X30_GPIO_INT_EN_7 MSM_GPIO1_REG(0x22C) 256 - 257 - /* same pin map as above, write 1 to clear interrupt */ 258 - #define MSM7X30_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0x90) 259 - #define MSM7X30_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68) 260 - #define MSM7X30_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0x94) 261 - #define MSM7X30_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0x98) 262 - #define MSM7X30_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0x9C) 263 - #define MSM7X30_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xB4) 264 - #define MSM7X30_GPIO_INT_CLEAR_6 MSM_GPIO1_REG(0xDC) 265 - #define MSM7X30_GPIO_INT_CLEAR_7 MSM_GPIO1_REG(0x230) 266 - 267 - /* same pin map as above, 1=interrupt pending */ 268 - #define MSM7X30_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xA0) 269 - #define MSM7X30_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70) 270 - #define MSM7X30_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xA4) 271 - #define MSM7X30_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xA8) 272 - #define MSM7X30_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xAC) 273 - #define MSM7X30_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0xB0) 274 - #define MSM7X30_GPIO_INT_STATUS_6 MSM_GPIO1_REG(0xE0) 275 - #define MSM7X30_GPIO_INT_STATUS_7 MSM_GPIO1_REG(0x234) 276 - 277 - #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0) 278 - 279 - #define MSM_GPIO_BANK(soc, bank, first, last) \ 280 - { \ 281 - .regs[MSM_GPIO_OUT] = soc##_GPIO_OUT_##bank, \ 282 - .regs[MSM_GPIO_IN] = soc##_GPIO_IN_##bank, \ 283 - .regs[MSM_GPIO_INT_STATUS] = soc##_GPIO_INT_STATUS_##bank, \ 284 - .regs[MSM_GPIO_INT_CLEAR] = soc##_GPIO_INT_CLEAR_##bank, \ 285 - .regs[MSM_GPIO_INT_EN] = soc##_GPIO_INT_EN_##bank, \ 286 - .regs[MSM_GPIO_INT_EDGE] = soc##_GPIO_INT_EDGE_##bank, \ 287 - .regs[MSM_GPIO_INT_POS] = soc##_GPIO_INT_POS_##bank, \ 288 - .regs[MSM_GPIO_OE] = soc##_GPIO_OE_##bank, \ 289 - .chip = { \ 290 - .base = (first), \ 291 - .ngpio = (last) - (first) + 1, \ 292 - .get = msm_gpio_get, \ 293 - .set = msm_gpio_set, \ 294 - .direction_input = msm_gpio_direction_input, \ 295 - .direction_output = msm_gpio_direction_output, \ 296 - .to_irq = msm_gpio_to_irq, \ 297 - .request = msm_gpio_request, \ 298 - .free = msm_gpio_free, \ 299 - } \ 300 - } 301 - 302 - #define MSM_GPIO_BROKEN_INT_CLEAR 1 303 - 304 - enum msm_gpio_reg { 305 - MSM_GPIO_IN, 306 - MSM_GPIO_OUT, 307 - MSM_GPIO_INT_STATUS, 308 - MSM_GPIO_INT_CLEAR, 309 - MSM_GPIO_INT_EN, 310 - MSM_GPIO_INT_EDGE, 311 - MSM_GPIO_INT_POS, 312 - MSM_GPIO_OE, 313 - MSM_GPIO_REG_NR 314 - }; 315 - 316 - struct msm_gpio_chip { 317 - spinlock_t lock; 318 - struct gpio_chip chip; 319 - unsigned long regs[MSM_GPIO_REG_NR]; 320 - #if MSM_GPIO_BROKEN_INT_CLEAR 321 - unsigned int_status_copy; 322 - #endif 323 - unsigned int both_edge_detect; 324 - unsigned int int_enable[2]; /* 0: awake, 1: sleep */ 325 - void __iomem *base; 326 - }; 327 - 328 - struct msm_gpio_initdata { 329 - struct msm_gpio_chip *chips; 330 - int count; 331 - }; 332 - 333 - static void msm_gpio_writel(struct msm_gpio_chip *chip, u32 val, 334 - enum msm_gpio_reg reg) 335 - { 336 - writel(val, chip->base + chip->regs[reg]); 337 - } 338 - 339 - static u32 msm_gpio_readl(struct msm_gpio_chip *chip, enum msm_gpio_reg reg) 340 - { 341 - return readl(chip->base + chip->regs[reg]); 342 - } 343 - 344 - static int msm_gpio_write(struct msm_gpio_chip *msm_chip, 345 - unsigned offset, unsigned on) 346 - { 347 - unsigned mask = BIT(offset); 348 - unsigned val; 349 - 350 - val = msm_gpio_readl(msm_chip, MSM_GPIO_OUT); 351 - if (on) 352 - msm_gpio_writel(msm_chip, val | mask, MSM_GPIO_OUT); 353 - else 354 - msm_gpio_writel(msm_chip, val & ~mask, MSM_GPIO_OUT); 355 - return 0; 356 - } 357 - 358 - static void msm_gpio_update_both_edge_detect(struct msm_gpio_chip *msm_chip) 359 - { 360 - int loop_limit = 100; 361 - unsigned pol, val, val2, intstat; 362 - do { 363 - val = msm_gpio_readl(msm_chip, MSM_GPIO_IN); 364 - pol = msm_gpio_readl(msm_chip, MSM_GPIO_INT_POS); 365 - pol = (pol & ~msm_chip->both_edge_detect) | 366 - (~val & msm_chip->both_edge_detect); 367 - msm_gpio_writel(msm_chip, pol, MSM_GPIO_INT_POS); 368 - intstat = msm_gpio_readl(msm_chip, MSM_GPIO_INT_STATUS); 369 - val2 = msm_gpio_readl(msm_chip, MSM_GPIO_IN); 370 - if (((val ^ val2) & msm_chip->both_edge_detect & ~intstat) == 0) 371 - return; 372 - } while (loop_limit-- > 0); 373 - printk(KERN_ERR "msm_gpio_update_both_edge_detect, " 374 - "failed to reach stable state %x != %x\n", val, val2); 375 - } 376 - 377 - static int msm_gpio_clear_detect_status(struct msm_gpio_chip *msm_chip, 378 - unsigned offset) 379 - { 380 - unsigned bit = BIT(offset); 381 - 382 - #if MSM_GPIO_BROKEN_INT_CLEAR 383 - /* Save interrupts that already triggered before we loose them. */ 384 - /* Any interrupt that triggers between the read of int_status */ 385 - /* and the write to int_clear will still be lost though. */ 386 - msm_chip->int_status_copy |= 387 - msm_gpio_readl(msm_chip, MSM_GPIO_INT_STATUS); 388 - msm_chip->int_status_copy &= ~bit; 389 - #endif 390 - msm_gpio_writel(msm_chip, bit, MSM_GPIO_INT_CLEAR); 391 - msm_gpio_update_both_edge_detect(msm_chip); 392 - return 0; 393 - } 394 - 395 - static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 396 - { 397 - struct msm_gpio_chip *msm_chip; 398 - unsigned long irq_flags; 399 - u32 val; 400 - 401 - msm_chip = container_of(chip, struct msm_gpio_chip, chip); 402 - spin_lock_irqsave(&msm_chip->lock, irq_flags); 403 - val = msm_gpio_readl(msm_chip, MSM_GPIO_OE) & ~BIT(offset); 404 - msm_gpio_writel(msm_chip, val, MSM_GPIO_OE); 405 - spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 406 - return 0; 407 - } 408 - 409 - static int 410 - msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) 411 - { 412 - struct msm_gpio_chip *msm_chip; 413 - unsigned long irq_flags; 414 - u32 val; 415 - 416 - msm_chip = container_of(chip, struct msm_gpio_chip, chip); 417 - spin_lock_irqsave(&msm_chip->lock, irq_flags); 418 - msm_gpio_write(msm_chip, offset, value); 419 - val = msm_gpio_readl(msm_chip, MSM_GPIO_OE) | BIT(offset); 420 - msm_gpio_writel(msm_chip, val, MSM_GPIO_OE); 421 - spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 422 - return 0; 423 - } 424 - 425 - static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) 426 - { 427 - struct msm_gpio_chip *msm_chip; 428 - 429 - msm_chip = container_of(chip, struct msm_gpio_chip, chip); 430 - return (msm_gpio_readl(msm_chip, MSM_GPIO_IN) & (1U << offset)) ? 1 : 0; 431 - } 432 - 433 - static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 434 - { 435 - struct msm_gpio_chip *msm_chip; 436 - unsigned long irq_flags; 437 - 438 - msm_chip = container_of(chip, struct msm_gpio_chip, chip); 439 - spin_lock_irqsave(&msm_chip->lock, irq_flags); 440 - msm_gpio_write(msm_chip, offset, value); 441 - spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 442 - } 443 - 444 - static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 445 - { 446 - return MSM_GPIO_TO_INT(chip->base + offset); 447 - } 448 - 449 - #ifdef CONFIG_MSM_GPIOMUX 450 - static int msm_gpio_request(struct gpio_chip *chip, unsigned offset) 451 - { 452 - return msm_gpiomux_get(chip->base + offset); 453 - } 454 - 455 - static void msm_gpio_free(struct gpio_chip *chip, unsigned offset) 456 - { 457 - msm_gpiomux_put(chip->base + offset); 458 - } 459 - #else 460 - #define msm_gpio_request NULL 461 - #define msm_gpio_free NULL 462 - #endif 463 - 464 - static struct msm_gpio_chip *msm_gpio_chips; 465 - static int msm_gpio_count; 466 - 467 - static struct msm_gpio_chip msm_gpio_chips_msm7x01[] = { 468 - MSM_GPIO_BANK(MSM7X00, 0, 0, 15), 469 - MSM_GPIO_BANK(MSM7X00, 1, 16, 42), 470 - MSM_GPIO_BANK(MSM7X00, 2, 43, 67), 471 - MSM_GPIO_BANK(MSM7X00, 3, 68, 94), 472 - MSM_GPIO_BANK(MSM7X00, 4, 95, 106), 473 - MSM_GPIO_BANK(MSM7X00, 5, 107, 121), 474 - }; 475 - 476 - static struct msm_gpio_initdata msm_gpio_7x01_init = { 477 - .chips = msm_gpio_chips_msm7x01, 478 - .count = ARRAY_SIZE(msm_gpio_chips_msm7x01), 479 - }; 480 - 481 - static struct msm_gpio_chip msm_gpio_chips_msm7x30[] = { 482 - MSM_GPIO_BANK(MSM7X30, 0, 0, 15), 483 - MSM_GPIO_BANK(MSM7X30, 1, 16, 43), 484 - MSM_GPIO_BANK(MSM7X30, 2, 44, 67), 485 - MSM_GPIO_BANK(MSM7X30, 3, 68, 94), 486 - MSM_GPIO_BANK(MSM7X30, 4, 95, 106), 487 - MSM_GPIO_BANK(MSM7X30, 5, 107, 133), 488 - MSM_GPIO_BANK(MSM7X30, 6, 134, 150), 489 - MSM_GPIO_BANK(MSM7X30, 7, 151, 181), 490 - }; 491 - 492 - static struct msm_gpio_initdata msm_gpio_7x30_init = { 493 - .chips = msm_gpio_chips_msm7x30, 494 - .count = ARRAY_SIZE(msm_gpio_chips_msm7x30), 495 - }; 496 - 497 - static struct msm_gpio_chip msm_gpio_chips_qsd8x50[] = { 498 - MSM_GPIO_BANK(QSD8X50, 0, 0, 15), 499 - MSM_GPIO_BANK(QSD8X50, 1, 16, 42), 500 - MSM_GPIO_BANK(QSD8X50, 2, 43, 67), 501 - MSM_GPIO_BANK(QSD8X50, 3, 68, 94), 502 - MSM_GPIO_BANK(QSD8X50, 4, 95, 103), 503 - MSM_GPIO_BANK(QSD8X50, 5, 104, 121), 504 - MSM_GPIO_BANK(QSD8X50, 6, 122, 152), 505 - MSM_GPIO_BANK(QSD8X50, 7, 153, 164), 506 - }; 507 - 508 - static struct msm_gpio_initdata msm_gpio_8x50_init = { 509 - .chips = msm_gpio_chips_qsd8x50, 510 - .count = ARRAY_SIZE(msm_gpio_chips_qsd8x50), 511 - }; 512 - 513 - static void msm_gpio_irq_ack(struct irq_data *d) 514 - { 515 - unsigned long irq_flags; 516 - struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); 517 - spin_lock_irqsave(&msm_chip->lock, irq_flags); 518 - msm_gpio_clear_detect_status(msm_chip, 519 - d->irq - gpio_to_irq(msm_chip->chip.base)); 520 - spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 521 - } 522 - 523 - static void msm_gpio_irq_mask(struct irq_data *d) 524 - { 525 - unsigned long irq_flags; 526 - struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); 527 - unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base); 528 - 529 - spin_lock_irqsave(&msm_chip->lock, irq_flags); 530 - /* level triggered interrupts are also latched */ 531 - if (!(msm_gpio_readl(msm_chip, MSM_GPIO_INT_EDGE) & BIT(offset))) 532 - msm_gpio_clear_detect_status(msm_chip, offset); 533 - msm_chip->int_enable[0] &= ~BIT(offset); 534 - msm_gpio_writel(msm_chip, msm_chip->int_enable[0], MSM_GPIO_INT_EN); 535 - spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 536 - } 537 - 538 - static void msm_gpio_irq_unmask(struct irq_data *d) 539 - { 540 - unsigned long irq_flags; 541 - struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); 542 - unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base); 543 - 544 - spin_lock_irqsave(&msm_chip->lock, irq_flags); 545 - /* level triggered interrupts are also latched */ 546 - if (!(msm_gpio_readl(msm_chip, MSM_GPIO_INT_EDGE) & BIT(offset))) 547 - msm_gpio_clear_detect_status(msm_chip, offset); 548 - msm_chip->int_enable[0] |= BIT(offset); 549 - msm_gpio_writel(msm_chip, msm_chip->int_enable[0], MSM_GPIO_INT_EN); 550 - spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 551 - } 552 - 553 - static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) 554 - { 555 - unsigned long irq_flags; 556 - struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); 557 - unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base); 558 - 559 - spin_lock_irqsave(&msm_chip->lock, irq_flags); 560 - 561 - if (on) 562 - msm_chip->int_enable[1] |= BIT(offset); 563 - else 564 - msm_chip->int_enable[1] &= ~BIT(offset); 565 - 566 - spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 567 - return 0; 568 - } 569 - 570 - static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type) 571 - { 572 - unsigned long irq_flags; 573 - struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d); 574 - unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base); 575 - unsigned val, mask = BIT(offset); 576 - 577 - spin_lock_irqsave(&msm_chip->lock, irq_flags); 578 - val = msm_gpio_readl(msm_chip, MSM_GPIO_INT_EDGE); 579 - if (flow_type & IRQ_TYPE_EDGE_BOTH) { 580 - msm_gpio_writel(msm_chip, val | mask, MSM_GPIO_INT_EDGE); 581 - __irq_set_handler_locked(d->irq, handle_edge_irq); 582 - } else { 583 - msm_gpio_writel(msm_chip, val & ~mask, MSM_GPIO_INT_EDGE); 584 - __irq_set_handler_locked(d->irq, handle_level_irq); 585 - } 586 - if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) { 587 - msm_chip->both_edge_detect |= mask; 588 - msm_gpio_update_both_edge_detect(msm_chip); 589 - } else { 590 - msm_chip->both_edge_detect &= ~mask; 591 - val = msm_gpio_readl(msm_chip, MSM_GPIO_INT_POS); 592 - if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_HIGH)) 593 - val |= mask; 594 - else 595 - val &= ~mask; 596 - msm_gpio_writel(msm_chip, val, MSM_GPIO_INT_POS); 597 - } 598 - spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 599 - return 0; 600 - } 601 - 602 - static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 603 - { 604 - int i, j, mask; 605 - unsigned val; 606 - 607 - for (i = 0; i < msm_gpio_count; i++) { 608 - struct msm_gpio_chip *msm_chip = &msm_gpio_chips[i]; 609 - val = msm_gpio_readl(msm_chip, MSM_GPIO_INT_STATUS); 610 - val &= msm_chip->int_enable[0]; 611 - while (val) { 612 - mask = val & -val; 613 - j = fls(mask) - 1; 614 - /* printk("%s %08x %08x bit %d gpio %d irq %d\n", 615 - __func__, v, m, j, msm_chip->chip.start + j, 616 - FIRST_GPIO_IRQ + msm_chip->chip.start + j); */ 617 - val &= ~mask; 618 - generic_handle_irq(FIRST_GPIO_IRQ + 619 - msm_chip->chip.base + j); 620 - } 621 - } 622 - desc->irq_data.chip->irq_ack(&desc->irq_data); 623 - } 624 - 625 - static struct irq_chip msm_gpio_irq_chip = { 626 - .name = "msmgpio", 627 - .irq_ack = msm_gpio_irq_ack, 628 - .irq_mask = msm_gpio_irq_mask, 629 - .irq_unmask = msm_gpio_irq_unmask, 630 - .irq_set_wake = msm_gpio_irq_set_wake, 631 - .irq_set_type = msm_gpio_irq_set_type, 632 - }; 633 - 634 - static int gpio_msm_v1_probe(struct platform_device *pdev) 635 - { 636 - int i, j = 0; 637 - const struct platform_device_id *dev_id = platform_get_device_id(pdev); 638 - struct msm_gpio_initdata *data; 639 - int irq1, irq2; 640 - struct resource *res; 641 - void __iomem *base1, __iomem *base2; 642 - 643 - data = (struct msm_gpio_initdata *)dev_id->driver_data; 644 - msm_gpio_chips = data->chips; 645 - msm_gpio_count = data->count; 646 - 647 - irq1 = platform_get_irq(pdev, 0); 648 - if (irq1 < 0) 649 - return irq1; 650 - 651 - irq2 = platform_get_irq(pdev, 1); 652 - if (irq2 < 0) 653 - return irq2; 654 - 655 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 656 - base1 = devm_ioremap_resource(&pdev->dev, res); 657 - if (IS_ERR(base1)) 658 - return PTR_ERR(base1); 659 - 660 - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 661 - base2 = devm_ioremap_resource(&pdev->dev, res); 662 - if (IS_ERR(base2)) 663 - return PTR_ERR(base2); 664 - 665 - for (i = FIRST_GPIO_IRQ; i < FIRST_GPIO_IRQ + NR_GPIO_IRQS; i++) { 666 - if (i - FIRST_GPIO_IRQ >= 667 - msm_gpio_chips[j].chip.base + 668 - msm_gpio_chips[j].chip.ngpio) 669 - j++; 670 - irq_set_chip_data(i, &msm_gpio_chips[j]); 671 - irq_set_chip_and_handler(i, &msm_gpio_irq_chip, 672 - handle_edge_irq); 673 - set_irq_flags(i, IRQF_VALID); 674 - } 675 - 676 - for (i = 0; i < msm_gpio_count; i++) { 677 - if (i == 1) 678 - msm_gpio_chips[i].base = base2; 679 - else 680 - msm_gpio_chips[i].base = base1; 681 - spin_lock_init(&msm_gpio_chips[i].lock); 682 - msm_gpio_writel(&msm_gpio_chips[i], 0, MSM_GPIO_INT_EN); 683 - gpiochip_add(&msm_gpio_chips[i].chip); 684 - } 685 - 686 - irq_set_chained_handler(irq1, msm_gpio_irq_handler); 687 - irq_set_chained_handler(irq2, msm_gpio_irq_handler); 688 - irq_set_irq_wake(irq1, 1); 689 - irq_set_irq_wake(irq2, 1); 690 - return 0; 691 - } 692 - 693 - static struct platform_device_id gpio_msm_v1_device_ids[] = { 694 - { "gpio-msm-7201", (unsigned long)&msm_gpio_7x01_init }, 695 - { "gpio-msm-7x30", (unsigned long)&msm_gpio_7x30_init }, 696 - { "gpio-msm-8x50", (unsigned long)&msm_gpio_8x50_init }, 697 - { } 698 - }; 699 - MODULE_DEVICE_TABLE(platform, gpio_msm_v1_device_ids); 700 - 701 - static struct platform_driver gpio_msm_v1_driver = { 702 - .driver = { 703 - .name = "gpio-msm-v1", 704 - }, 705 - .probe = gpio_msm_v1_probe, 706 - .id_table = gpio_msm_v1_device_ids, 707 - }; 708 - 709 - static int __init gpio_msm_v1_init(void) 710 - { 711 - return platform_driver_register(&gpio_msm_v1_driver); 712 - } 713 - postcore_initcall(gpio_msm_v1_init); 714 - MODULE_LICENSE("GPL v2");
-8
drivers/mmc/host/Kconfig
··· 408 408 409 409 If unsure, say N. 410 410 411 - config MMC_MSM 412 - tristate "Qualcomm SDCC Controller Support" 413 - depends on MMC && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50) 414 - help 415 - This provides support for the SD/MMC cell found in the 416 - MSM and QSD SOCs from Qualcomm. The controller also has 417 - support for SDIO devices. 418 - 419 411 config MMC_MXC 420 412 tristate "Freescale i.MX21/27/31 or MPC512x Multimedia Card support" 421 413 depends on ARCH_MXC || PPC_MPC512x
-1
drivers/mmc/host/Makefile
··· 24 24 obj-$(CONFIG_MMC_OMAP_HS) += omap_hsmmc.o 25 25 obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o 26 26 obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o 27 - obj-$(CONFIG_MMC_MSM) += msm_sdcc.o 28 27 obj-$(CONFIG_MMC_MVSDIO) += mvsdio.o 29 28 obj-$(CONFIG_MMC_DAVINCI) += davinci_mmc.o 30 29 obj-$(CONFIG_MMC_GOLDFISH) += android-goldfish.o
-1474
drivers/mmc/host/msm_sdcc.c
··· 1 - /* 2 - * linux/drivers/mmc/host/msm_sdcc.c - Qualcomm MSM 7X00A SDCC Driver 3 - * 4 - * Copyright (C) 2007 Google Inc, 5 - * Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved. 6 - * Copyright (C) 2009, Code Aurora Forum. All Rights Reserved. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - * 12 - * Based on mmci.c 13 - * 14 - * Author: San Mehat (san@android.com) 15 - * 16 - */ 17 - 18 - #include <linux/module.h> 19 - #include <linux/moduleparam.h> 20 - #include <linux/init.h> 21 - #include <linux/ioport.h> 22 - #include <linux/device.h> 23 - #include <linux/interrupt.h> 24 - #include <linux/delay.h> 25 - #include <linux/err.h> 26 - #include <linux/highmem.h> 27 - #include <linux/log2.h> 28 - #include <linux/mmc/host.h> 29 - #include <linux/mmc/card.h> 30 - #include <linux/mmc/sdio.h> 31 - #include <linux/clk.h> 32 - #include <linux/scatterlist.h> 33 - #include <linux/platform_device.h> 34 - #include <linux/dma-mapping.h> 35 - #include <linux/debugfs.h> 36 - #include <linux/io.h> 37 - #include <linux/memory.h> 38 - #include <linux/gfp.h> 39 - #include <linux/gpio.h> 40 - 41 - #include <asm/cacheflush.h> 42 - #include <asm/div64.h> 43 - #include <asm/sizes.h> 44 - 45 - #include <linux/platform_data/mmc-msm_sdcc.h> 46 - #include <mach/dma.h> 47 - #include <mach/clk.h> 48 - 49 - #include "msm_sdcc.h" 50 - 51 - #define DRIVER_NAME "msm-sdcc" 52 - 53 - #define BUSCLK_PWRSAVE 1 54 - #define BUSCLK_TIMEOUT (HZ) 55 - static unsigned int msmsdcc_fmin = 144000; 56 - static unsigned int msmsdcc_fmax = 50000000; 57 - static unsigned int msmsdcc_4bit = 1; 58 - static unsigned int msmsdcc_pwrsave = 1; 59 - static unsigned int msmsdcc_piopoll = 1; 60 - static unsigned int msmsdcc_sdioirq; 61 - 62 - #define PIO_SPINMAX 30 63 - #define CMD_SPINMAX 20 64 - 65 - 66 - static inline void 67 - msmsdcc_disable_clocks(struct msmsdcc_host *host, int deferr) 68 - { 69 - WARN_ON(!host->clks_on); 70 - 71 - BUG_ON(host->curr.mrq); 72 - 73 - if (deferr) { 74 - mod_timer(&host->busclk_timer, jiffies + BUSCLK_TIMEOUT); 75 - } else { 76 - del_timer_sync(&host->busclk_timer); 77 - /* Need to check clks_on again in case the busclk 78 - * timer fired 79 - */ 80 - if (host->clks_on) { 81 - clk_disable(host->clk); 82 - clk_disable(host->pclk); 83 - host->clks_on = 0; 84 - } 85 - } 86 - } 87 - 88 - static inline int 89 - msmsdcc_enable_clocks(struct msmsdcc_host *host) 90 - { 91 - int rc; 92 - 93 - del_timer_sync(&host->busclk_timer); 94 - 95 - if (!host->clks_on) { 96 - rc = clk_enable(host->pclk); 97 - if (rc) 98 - return rc; 99 - rc = clk_enable(host->clk); 100 - if (rc) { 101 - clk_disable(host->pclk); 102 - return rc; 103 - } 104 - udelay(1 + ((3 * USEC_PER_SEC) / 105 - (host->clk_rate ? host->clk_rate : msmsdcc_fmin))); 106 - host->clks_on = 1; 107 - } 108 - return 0; 109 - } 110 - 111 - static inline unsigned int 112 - msmsdcc_readl(struct msmsdcc_host *host, unsigned int reg) 113 - { 114 - return readl(host->base + reg); 115 - } 116 - 117 - static inline void 118 - msmsdcc_writel(struct msmsdcc_host *host, u32 data, unsigned int reg) 119 - { 120 - writel(data, host->base + reg); 121 - /* 3 clk delay required! */ 122 - udelay(1 + ((3 * USEC_PER_SEC) / 123 - (host->clk_rate ? host->clk_rate : msmsdcc_fmin))); 124 - } 125 - 126 - static void 127 - msmsdcc_start_command(struct msmsdcc_host *host, struct mmc_command *cmd, 128 - u32 c); 129 - 130 - static void msmsdcc_reset_and_restore(struct msmsdcc_host *host) 131 - { 132 - u32 mci_clk = 0; 133 - u32 mci_mask0 = 0; 134 - int ret = 0; 135 - 136 - /* Save the controller state */ 137 - mci_clk = readl(host->base + MMCICLOCK); 138 - mci_mask0 = readl(host->base + MMCIMASK0); 139 - 140 - /* Reset the controller */ 141 - ret = clk_reset(host->clk, CLK_RESET_ASSERT); 142 - if (ret) 143 - pr_err("%s: Clock assert failed at %u Hz with err %d\n", 144 - mmc_hostname(host->mmc), host->clk_rate, ret); 145 - 146 - ret = clk_reset(host->clk, CLK_RESET_DEASSERT); 147 - if (ret) 148 - pr_err("%s: Clock deassert failed at %u Hz with err %d\n", 149 - mmc_hostname(host->mmc), host->clk_rate, ret); 150 - 151 - pr_info("%s: Controller has been re-initialiazed\n", 152 - mmc_hostname(host->mmc)); 153 - 154 - /* Restore the contoller state */ 155 - writel(host->pwr, host->base + MMCIPOWER); 156 - writel(mci_clk, host->base + MMCICLOCK); 157 - writel(mci_mask0, host->base + MMCIMASK0); 158 - ret = clk_set_rate(host->clk, host->clk_rate); 159 - if (ret) 160 - pr_err("%s: Failed to set clk rate %u Hz (%d)\n", 161 - mmc_hostname(host->mmc), host->clk_rate, ret); 162 - } 163 - 164 - static void 165 - msmsdcc_request_end(struct msmsdcc_host *host, struct mmc_request *mrq) 166 - { 167 - BUG_ON(host->curr.data); 168 - 169 - host->curr.mrq = NULL; 170 - host->curr.cmd = NULL; 171 - 172 - if (mrq->data) 173 - mrq->data->bytes_xfered = host->curr.data_xfered; 174 - if (mrq->cmd->error == -ETIMEDOUT) 175 - mdelay(5); 176 - 177 - #if BUSCLK_PWRSAVE 178 - msmsdcc_disable_clocks(host, 1); 179 - #endif 180 - /* 181 - * Need to drop the host lock here; mmc_request_done may call 182 - * back into the driver... 183 - */ 184 - spin_unlock(&host->lock); 185 - mmc_request_done(host->mmc, mrq); 186 - spin_lock(&host->lock); 187 - } 188 - 189 - static void 190 - msmsdcc_stop_data(struct msmsdcc_host *host) 191 - { 192 - host->curr.data = NULL; 193 - host->curr.got_dataend = 0; 194 - } 195 - 196 - uint32_t msmsdcc_fifo_addr(struct msmsdcc_host *host) 197 - { 198 - return host->memres->start + MMCIFIFO; 199 - } 200 - 201 - static inline void 202 - msmsdcc_start_command_exec(struct msmsdcc_host *host, u32 arg, u32 c) { 203 - msmsdcc_writel(host, arg, MMCIARGUMENT); 204 - msmsdcc_writel(host, c, MMCICOMMAND); 205 - } 206 - 207 - static void 208 - msmsdcc_dma_exec_func(struct msm_dmov_cmd *cmd) 209 - { 210 - struct msmsdcc_host *host = (struct msmsdcc_host *)cmd->data; 211 - 212 - msmsdcc_writel(host, host->cmd_timeout, MMCIDATATIMER); 213 - msmsdcc_writel(host, (unsigned int)host->curr.xfer_size, 214 - MMCIDATALENGTH); 215 - msmsdcc_writel(host, (msmsdcc_readl(host, MMCIMASK0) & 216 - (~MCI_IRQ_PIO)) | host->cmd_pio_irqmask, MMCIMASK0); 217 - msmsdcc_writel(host, host->cmd_datactrl, MMCIDATACTRL); 218 - 219 - if (host->cmd_cmd) { 220 - msmsdcc_start_command_exec(host, 221 - (u32) host->cmd_cmd->arg, 222 - (u32) host->cmd_c); 223 - } 224 - host->dma.active = 1; 225 - } 226 - 227 - static void 228 - msmsdcc_dma_complete_tlet(unsigned long data) 229 - { 230 - struct msmsdcc_host *host = (struct msmsdcc_host *)data; 231 - unsigned long flags; 232 - struct mmc_request *mrq; 233 - struct msm_dmov_errdata err; 234 - 235 - spin_lock_irqsave(&host->lock, flags); 236 - host->dma.active = 0; 237 - 238 - err = host->dma.err; 239 - mrq = host->curr.mrq; 240 - BUG_ON(!mrq); 241 - WARN_ON(!mrq->data); 242 - 243 - if (!(host->dma.result & DMOV_RSLT_VALID)) { 244 - pr_err("msmsdcc: Invalid DataMover result\n"); 245 - goto out; 246 - } 247 - 248 - if (host->dma.result & DMOV_RSLT_DONE) { 249 - host->curr.data_xfered = host->curr.xfer_size; 250 - } else { 251 - /* Error or flush */ 252 - if (host->dma.result & DMOV_RSLT_ERROR) 253 - pr_err("%s: DMA error (0x%.8x)\n", 254 - mmc_hostname(host->mmc), host->dma.result); 255 - if (host->dma.result & DMOV_RSLT_FLUSH) 256 - pr_err("%s: DMA channel flushed (0x%.8x)\n", 257 - mmc_hostname(host->mmc), host->dma.result); 258 - 259 - pr_err("Flush data: %.8x %.8x %.8x %.8x %.8x %.8x\n", 260 - err.flush[0], err.flush[1], err.flush[2], 261 - err.flush[3], err.flush[4], err.flush[5]); 262 - 263 - msmsdcc_reset_and_restore(host); 264 - if (!mrq->data->error) 265 - mrq->data->error = -EIO; 266 - } 267 - dma_unmap_sg(mmc_dev(host->mmc), host->dma.sg, host->dma.num_ents, 268 - host->dma.dir); 269 - 270 - host->dma.sg = NULL; 271 - host->dma.busy = 0; 272 - 273 - if (host->curr.got_dataend || mrq->data->error) { 274 - 275 - /* 276 - * If we've already gotten our DATAEND / DATABLKEND 277 - * for this request, then complete it through here. 278 - */ 279 - msmsdcc_stop_data(host); 280 - 281 - if (!mrq->data->error) 282 - host->curr.data_xfered = host->curr.xfer_size; 283 - if (!mrq->data->stop || mrq->cmd->error) { 284 - host->curr.mrq = NULL; 285 - host->curr.cmd = NULL; 286 - mrq->data->bytes_xfered = host->curr.data_xfered; 287 - 288 - spin_unlock_irqrestore(&host->lock, flags); 289 - #if BUSCLK_PWRSAVE 290 - msmsdcc_disable_clocks(host, 1); 291 - #endif 292 - mmc_request_done(host->mmc, mrq); 293 - return; 294 - } else 295 - msmsdcc_start_command(host, mrq->data->stop, 0); 296 - } 297 - 298 - out: 299 - spin_unlock_irqrestore(&host->lock, flags); 300 - return; 301 - } 302 - 303 - static void 304 - msmsdcc_dma_complete_func(struct msm_dmov_cmd *cmd, 305 - unsigned int result, 306 - struct msm_dmov_errdata *err) 307 - { 308 - struct msmsdcc_dma_data *dma_data = 309 - container_of(cmd, struct msmsdcc_dma_data, hdr); 310 - struct msmsdcc_host *host = dma_data->host; 311 - 312 - dma_data->result = result; 313 - if (err) 314 - memcpy(&dma_data->err, err, sizeof(struct msm_dmov_errdata)); 315 - 316 - tasklet_schedule(&host->dma_tlet); 317 - } 318 - 319 - static int validate_dma(struct msmsdcc_host *host, struct mmc_data *data) 320 - { 321 - if (host->dma.channel == -1) 322 - return -ENOENT; 323 - 324 - if ((data->blksz * data->blocks) < MCI_FIFOSIZE) 325 - return -EINVAL; 326 - if ((data->blksz * data->blocks) % MCI_FIFOSIZE) 327 - return -EINVAL; 328 - return 0; 329 - } 330 - 331 - static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data) 332 - { 333 - struct msmsdcc_nc_dmadata *nc; 334 - dmov_box *box; 335 - uint32_t rows; 336 - uint32_t crci; 337 - unsigned int n; 338 - int i, rc; 339 - struct scatterlist *sg = data->sg; 340 - 341 - rc = validate_dma(host, data); 342 - if (rc) 343 - return rc; 344 - 345 - host->dma.sg = data->sg; 346 - host->dma.num_ents = data->sg_len; 347 - 348 - BUG_ON(host->dma.num_ents > NR_SG); /* Prevent memory corruption */ 349 - 350 - nc = host->dma.nc; 351 - 352 - switch (host->pdev_id) { 353 - case 1: 354 - crci = MSMSDCC_CRCI_SDC1; 355 - break; 356 - case 2: 357 - crci = MSMSDCC_CRCI_SDC2; 358 - break; 359 - case 3: 360 - crci = MSMSDCC_CRCI_SDC3; 361 - break; 362 - case 4: 363 - crci = MSMSDCC_CRCI_SDC4; 364 - break; 365 - default: 366 - host->dma.sg = NULL; 367 - host->dma.num_ents = 0; 368 - return -ENOENT; 369 - } 370 - 371 - if (data->flags & MMC_DATA_READ) 372 - host->dma.dir = DMA_FROM_DEVICE; 373 - else 374 - host->dma.dir = DMA_TO_DEVICE; 375 - 376 - host->curr.user_pages = 0; 377 - 378 - box = &nc->cmd[0]; 379 - 380 - /* location of command block must be 64 bit aligned */ 381 - BUG_ON(host->dma.cmd_busaddr & 0x07); 382 - 383 - nc->cmdptr = (host->dma.cmd_busaddr >> 3) | CMD_PTR_LP; 384 - host->dma.hdr.cmdptr = DMOV_CMD_PTR_LIST | 385 - DMOV_CMD_ADDR(host->dma.cmdptr_busaddr); 386 - host->dma.hdr.complete_func = msmsdcc_dma_complete_func; 387 - 388 - n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg, 389 - host->dma.num_ents, host->dma.dir); 390 - if (n == 0) { 391 - pr_err("%s: Unable to map in all sg elements\n", 392 - mmc_hostname(host->mmc)); 393 - host->dma.sg = NULL; 394 - host->dma.num_ents = 0; 395 - return -ENOMEM; 396 - } 397 - 398 - for_each_sg(host->dma.sg, sg, n, i) { 399 - 400 - box->cmd = CMD_MODE_BOX; 401 - 402 - if (i == n - 1) 403 - box->cmd |= CMD_LC; 404 - rows = (sg_dma_len(sg) % MCI_FIFOSIZE) ? 405 - (sg_dma_len(sg) / MCI_FIFOSIZE) + 1 : 406 - (sg_dma_len(sg) / MCI_FIFOSIZE) ; 407 - 408 - if (data->flags & MMC_DATA_READ) { 409 - box->src_row_addr = msmsdcc_fifo_addr(host); 410 - box->dst_row_addr = sg_dma_address(sg); 411 - 412 - box->src_dst_len = (MCI_FIFOSIZE << 16) | 413 - (MCI_FIFOSIZE); 414 - box->row_offset = MCI_FIFOSIZE; 415 - 416 - box->num_rows = rows * ((1 << 16) + 1); 417 - box->cmd |= CMD_SRC_CRCI(crci); 418 - } else { 419 - box->src_row_addr = sg_dma_address(sg); 420 - box->dst_row_addr = msmsdcc_fifo_addr(host); 421 - 422 - box->src_dst_len = (MCI_FIFOSIZE << 16) | 423 - (MCI_FIFOSIZE); 424 - box->row_offset = (MCI_FIFOSIZE << 16); 425 - 426 - box->num_rows = rows * ((1 << 16) + 1); 427 - box->cmd |= CMD_DST_CRCI(crci); 428 - } 429 - box++; 430 - } 431 - 432 - return 0; 433 - } 434 - 435 - static int 436 - snoop_cccr_abort(struct mmc_command *cmd) 437 - { 438 - if ((cmd->opcode == 52) && 439 - (cmd->arg & 0x80000000) && 440 - (((cmd->arg >> 9) & 0x1ffff) == SDIO_CCCR_ABORT)) 441 - return 1; 442 - return 0; 443 - } 444 - 445 - static void 446 - msmsdcc_start_command_deferred(struct msmsdcc_host *host, 447 - struct mmc_command *cmd, u32 *c) 448 - { 449 - *c |= (cmd->opcode | MCI_CPSM_ENABLE); 450 - 451 - if (cmd->flags & MMC_RSP_PRESENT) { 452 - if (cmd->flags & MMC_RSP_136) 453 - *c |= MCI_CPSM_LONGRSP; 454 - *c |= MCI_CPSM_RESPONSE; 455 - } 456 - 457 - if (/*interrupt*/0) 458 - *c |= MCI_CPSM_INTERRUPT; 459 - 460 - if ((((cmd->opcode == 17) || (cmd->opcode == 18)) || 461 - ((cmd->opcode == 24) || (cmd->opcode == 25))) || 462 - (cmd->opcode == 53)) 463 - *c |= MCI_CSPM_DATCMD; 464 - 465 - if (host->prog_scan && (cmd->opcode == 12)) { 466 - *c |= MCI_CPSM_PROGENA; 467 - host->prog_enable = true; 468 - } 469 - 470 - if (cmd == cmd->mrq->stop) 471 - *c |= MCI_CSPM_MCIABORT; 472 - 473 - if (snoop_cccr_abort(cmd)) 474 - *c |= MCI_CSPM_MCIABORT; 475 - 476 - if (host->curr.cmd != NULL) { 477 - pr_err("%s: Overlapping command requests\n", 478 - mmc_hostname(host->mmc)); 479 - } 480 - host->curr.cmd = cmd; 481 - } 482 - 483 - static void 484 - msmsdcc_start_data(struct msmsdcc_host *host, struct mmc_data *data, 485 - struct mmc_command *cmd, u32 c) 486 - { 487 - unsigned int datactrl, timeout; 488 - unsigned long long clks; 489 - unsigned int pio_irqmask = 0; 490 - 491 - host->curr.data = data; 492 - host->curr.xfer_size = data->blksz * data->blocks; 493 - host->curr.xfer_remain = host->curr.xfer_size; 494 - host->curr.data_xfered = 0; 495 - host->curr.got_dataend = 0; 496 - 497 - memset(&host->pio, 0, sizeof(host->pio)); 498 - 499 - datactrl = MCI_DPSM_ENABLE | (data->blksz << 4); 500 - 501 - if (!msmsdcc_config_dma(host, data)) 502 - datactrl |= MCI_DPSM_DMAENABLE; 503 - else { 504 - host->pio.sg = data->sg; 505 - host->pio.sg_len = data->sg_len; 506 - host->pio.sg_off = 0; 507 - 508 - if (data->flags & MMC_DATA_READ) { 509 - pio_irqmask = MCI_RXFIFOHALFFULLMASK; 510 - if (host->curr.xfer_remain < MCI_FIFOSIZE) 511 - pio_irqmask |= MCI_RXDATAAVLBLMASK; 512 - } else 513 - pio_irqmask = MCI_TXFIFOHALFEMPTYMASK; 514 - } 515 - 516 - if (data->flags & MMC_DATA_READ) 517 - datactrl |= MCI_DPSM_DIRECTION; 518 - 519 - clks = (unsigned long long)data->timeout_ns * host->clk_rate; 520 - do_div(clks, NSEC_PER_SEC); 521 - timeout = data->timeout_clks + (unsigned int)clks*2 ; 522 - 523 - if (datactrl & MCI_DPSM_DMAENABLE) { 524 - /* Save parameters for the exec function */ 525 - host->cmd_timeout = timeout; 526 - host->cmd_pio_irqmask = pio_irqmask; 527 - host->cmd_datactrl = datactrl; 528 - host->cmd_cmd = cmd; 529 - 530 - host->dma.hdr.execute_func = msmsdcc_dma_exec_func; 531 - host->dma.hdr.data = (void *)host; 532 - host->dma.busy = 1; 533 - 534 - if (cmd) { 535 - msmsdcc_start_command_deferred(host, cmd, &c); 536 - host->cmd_c = c; 537 - } 538 - msm_dmov_enqueue_cmd(host->dma.channel, &host->dma.hdr); 539 - if (data->flags & MMC_DATA_WRITE) 540 - host->prog_scan = true; 541 - } else { 542 - msmsdcc_writel(host, timeout, MMCIDATATIMER); 543 - 544 - msmsdcc_writel(host, host->curr.xfer_size, MMCIDATALENGTH); 545 - 546 - msmsdcc_writel(host, (msmsdcc_readl(host, MMCIMASK0) & 547 - (~MCI_IRQ_PIO)) | pio_irqmask, MMCIMASK0); 548 - 549 - msmsdcc_writel(host, datactrl, MMCIDATACTRL); 550 - 551 - if (cmd) { 552 - /* Daisy-chain the command if requested */ 553 - msmsdcc_start_command(host, cmd, c); 554 - } 555 - } 556 - } 557 - 558 - static void 559 - msmsdcc_start_command(struct msmsdcc_host *host, struct mmc_command *cmd, u32 c) 560 - { 561 - if (cmd == cmd->mrq->stop) 562 - c |= MCI_CSPM_MCIABORT; 563 - 564 - host->stats.cmds++; 565 - 566 - msmsdcc_start_command_deferred(host, cmd, &c); 567 - msmsdcc_start_command_exec(host, cmd->arg, c); 568 - } 569 - 570 - static void 571 - msmsdcc_data_err(struct msmsdcc_host *host, struct mmc_data *data, 572 - unsigned int status) 573 - { 574 - if (status & MCI_DATACRCFAIL) { 575 - pr_err("%s: Data CRC error\n", mmc_hostname(host->mmc)); 576 - pr_err("%s: opcode 0x%.8x\n", __func__, 577 - data->mrq->cmd->opcode); 578 - pr_err("%s: blksz %d, blocks %d\n", __func__, 579 - data->blksz, data->blocks); 580 - data->error = -EILSEQ; 581 - } else if (status & MCI_DATATIMEOUT) { 582 - pr_err("%s: Data timeout\n", mmc_hostname(host->mmc)); 583 - data->error = -ETIMEDOUT; 584 - } else if (status & MCI_RXOVERRUN) { 585 - pr_err("%s: RX overrun\n", mmc_hostname(host->mmc)); 586 - data->error = -EIO; 587 - } else if (status & MCI_TXUNDERRUN) { 588 - pr_err("%s: TX underrun\n", mmc_hostname(host->mmc)); 589 - data->error = -EIO; 590 - } else { 591 - pr_err("%s: Unknown error (0x%.8x)\n", 592 - mmc_hostname(host->mmc), status); 593 - data->error = -EIO; 594 - } 595 - } 596 - 597 - 598 - static int 599 - msmsdcc_pio_read(struct msmsdcc_host *host, char *buffer, unsigned int remain) 600 - { 601 - uint32_t *ptr = (uint32_t *) buffer; 602 - int count = 0; 603 - 604 - if (remain % 4) 605 - remain = ((remain >> 2) + 1) << 2; 606 - 607 - while (msmsdcc_readl(host, MMCISTATUS) & MCI_RXDATAAVLBL) { 608 - *ptr = msmsdcc_readl(host, MMCIFIFO + (count % MCI_FIFOSIZE)); 609 - ptr++; 610 - count += sizeof(uint32_t); 611 - 612 - remain -= sizeof(uint32_t); 613 - if (remain == 0) 614 - break; 615 - } 616 - return count; 617 - } 618 - 619 - static int 620 - msmsdcc_pio_write(struct msmsdcc_host *host, char *buffer, 621 - unsigned int remain, u32 status) 622 - { 623 - void __iomem *base = host->base; 624 - char *ptr = buffer; 625 - 626 - do { 627 - unsigned int count, maxcnt, sz; 628 - 629 - maxcnt = status & MCI_TXFIFOEMPTY ? MCI_FIFOSIZE : 630 - MCI_FIFOHALFSIZE; 631 - count = min(remain, maxcnt); 632 - 633 - sz = count % 4 ? (count >> 2) + 1 : (count >> 2); 634 - writesl(base + MMCIFIFO, ptr, sz); 635 - ptr += count; 636 - remain -= count; 637 - 638 - if (remain == 0) 639 - break; 640 - 641 - status = msmsdcc_readl(host, MMCISTATUS); 642 - } while (status & MCI_TXFIFOHALFEMPTY); 643 - 644 - return ptr - buffer; 645 - } 646 - 647 - static int 648 - msmsdcc_spin_on_status(struct msmsdcc_host *host, uint32_t mask, int maxspin) 649 - { 650 - while (maxspin) { 651 - if ((msmsdcc_readl(host, MMCISTATUS) & mask)) 652 - return 0; 653 - udelay(1); 654 - --maxspin; 655 - } 656 - return -ETIMEDOUT; 657 - } 658 - 659 - static irqreturn_t 660 - msmsdcc_pio_irq(int irq, void *dev_id) 661 - { 662 - struct msmsdcc_host *host = dev_id; 663 - uint32_t status; 664 - u32 mci_mask0; 665 - 666 - status = msmsdcc_readl(host, MMCISTATUS); 667 - mci_mask0 = msmsdcc_readl(host, MMCIMASK0); 668 - 669 - if (((mci_mask0 & status) & MCI_IRQ_PIO) == 0) 670 - return IRQ_NONE; 671 - 672 - do { 673 - unsigned long flags; 674 - unsigned int remain, len; 675 - char *buffer; 676 - 677 - if (!(status & (MCI_TXFIFOHALFEMPTY | MCI_RXDATAAVLBL))) { 678 - if (host->curr.xfer_remain == 0 || !msmsdcc_piopoll) 679 - break; 680 - 681 - if (msmsdcc_spin_on_status(host, 682 - (MCI_TXFIFOHALFEMPTY | 683 - MCI_RXDATAAVLBL), 684 - PIO_SPINMAX)) { 685 - break; 686 - } 687 - } 688 - 689 - /* Map the current scatter buffer */ 690 - local_irq_save(flags); 691 - buffer = kmap_atomic(sg_page(host->pio.sg)) 692 - + host->pio.sg->offset; 693 - buffer += host->pio.sg_off; 694 - remain = host->pio.sg->length - host->pio.sg_off; 695 - len = 0; 696 - if (status & MCI_RXACTIVE) 697 - len = msmsdcc_pio_read(host, buffer, remain); 698 - if (status & MCI_TXACTIVE) 699 - len = msmsdcc_pio_write(host, buffer, remain, status); 700 - 701 - /* Unmap the buffer */ 702 - kunmap_atomic(buffer); 703 - local_irq_restore(flags); 704 - 705 - host->pio.sg_off += len; 706 - host->curr.xfer_remain -= len; 707 - host->curr.data_xfered += len; 708 - remain -= len; 709 - 710 - if (remain == 0) { 711 - /* This sg page is full - do some housekeeping */ 712 - if (status & MCI_RXACTIVE && host->curr.user_pages) 713 - flush_dcache_page(sg_page(host->pio.sg)); 714 - 715 - if (!--host->pio.sg_len) { 716 - memset(&host->pio, 0, sizeof(host->pio)); 717 - break; 718 - } 719 - 720 - /* Advance to next sg */ 721 - host->pio.sg++; 722 - host->pio.sg_off = 0; 723 - } 724 - 725 - status = msmsdcc_readl(host, MMCISTATUS); 726 - } while (1); 727 - 728 - if (status & MCI_RXACTIVE && host->curr.xfer_remain < MCI_FIFOSIZE) 729 - msmsdcc_writel(host, (mci_mask0 & (~MCI_IRQ_PIO)) | 730 - MCI_RXDATAAVLBLMASK, MMCIMASK0); 731 - 732 - if (!host->curr.xfer_remain) 733 - msmsdcc_writel(host, (mci_mask0 & (~MCI_IRQ_PIO)) | 0, 734 - MMCIMASK0); 735 - 736 - return IRQ_HANDLED; 737 - } 738 - 739 - static void msmsdcc_do_cmdirq(struct msmsdcc_host *host, uint32_t status) 740 - { 741 - struct mmc_command *cmd = host->curr.cmd; 742 - 743 - host->curr.cmd = NULL; 744 - cmd->resp[0] = msmsdcc_readl(host, MMCIRESPONSE0); 745 - cmd->resp[1] = msmsdcc_readl(host, MMCIRESPONSE1); 746 - cmd->resp[2] = msmsdcc_readl(host, MMCIRESPONSE2); 747 - cmd->resp[3] = msmsdcc_readl(host, MMCIRESPONSE3); 748 - 749 - if (status & MCI_CMDTIMEOUT) { 750 - cmd->error = -ETIMEDOUT; 751 - } else if (status & MCI_CMDCRCFAIL && 752 - cmd->flags & MMC_RSP_CRC) { 753 - pr_err("%s: Command CRC error\n", mmc_hostname(host->mmc)); 754 - cmd->error = -EILSEQ; 755 - } 756 - 757 - if (!cmd->data || cmd->error) { 758 - if (host->curr.data && host->dma.sg) 759 - msm_dmov_stop_cmd(host->dma.channel, 760 - &host->dma.hdr, 0); 761 - else if (host->curr.data) { /* Non DMA */ 762 - msmsdcc_reset_and_restore(host); 763 - msmsdcc_stop_data(host); 764 - msmsdcc_request_end(host, cmd->mrq); 765 - } else { /* host->data == NULL */ 766 - if (!cmd->error && host->prog_enable) { 767 - if (status & MCI_PROGDONE) { 768 - host->prog_scan = false; 769 - host->prog_enable = false; 770 - msmsdcc_request_end(host, cmd->mrq); 771 - } else { 772 - host->curr.cmd = cmd; 773 - } 774 - } else { 775 - if (host->prog_enable) { 776 - host->prog_scan = false; 777 - host->prog_enable = false; 778 - } 779 - msmsdcc_request_end(host, cmd->mrq); 780 - } 781 - } 782 - } else if (cmd->data) 783 - if (!(cmd->data->flags & MMC_DATA_READ)) 784 - msmsdcc_start_data(host, cmd->data, 785 - NULL, 0); 786 - } 787 - 788 - static void 789 - msmsdcc_handle_irq_data(struct msmsdcc_host *host, u32 status, 790 - void __iomem *base) 791 - { 792 - struct mmc_data *data = host->curr.data; 793 - 794 - if (status & (MCI_CMDSENT | MCI_CMDRESPEND | MCI_CMDCRCFAIL | 795 - MCI_CMDTIMEOUT | MCI_PROGDONE) && host->curr.cmd) { 796 - msmsdcc_do_cmdirq(host, status); 797 - } 798 - 799 - if (!data) 800 - return; 801 - 802 - /* Check for data errors */ 803 - if (status & (MCI_DATACRCFAIL | MCI_DATATIMEOUT | 804 - MCI_TXUNDERRUN | MCI_RXOVERRUN)) { 805 - msmsdcc_data_err(host, data, status); 806 - host->curr.data_xfered = 0; 807 - if (host->dma.sg) 808 - msm_dmov_stop_cmd(host->dma.channel, 809 - &host->dma.hdr, 0); 810 - else { 811 - msmsdcc_reset_and_restore(host); 812 - if (host->curr.data) 813 - msmsdcc_stop_data(host); 814 - if (!data->stop) 815 - msmsdcc_request_end(host, data->mrq); 816 - else 817 - msmsdcc_start_command(host, data->stop, 0); 818 - } 819 - } 820 - 821 - /* Check for data done */ 822 - if (!host->curr.got_dataend && (status & MCI_DATAEND)) 823 - host->curr.got_dataend = 1; 824 - 825 - /* 826 - * If DMA is still in progress, we complete via the completion handler 827 - */ 828 - if (host->curr.got_dataend && !host->dma.busy) { 829 - /* 830 - * There appears to be an issue in the controller where 831 - * if you request a small block transfer (< fifo size), 832 - * you may get your DATAEND/DATABLKEND irq without the 833 - * PIO data irq. 834 - * 835 - * Check to see if there is still data to be read, 836 - * and simulate a PIO irq. 837 - */ 838 - if (readl(base + MMCISTATUS) & MCI_RXDATAAVLBL) 839 - msmsdcc_pio_irq(1, host); 840 - 841 - msmsdcc_stop_data(host); 842 - if (!data->error) 843 - host->curr.data_xfered = host->curr.xfer_size; 844 - 845 - if (!data->stop) 846 - msmsdcc_request_end(host, data->mrq); 847 - else 848 - msmsdcc_start_command(host, data->stop, 0); 849 - } 850 - } 851 - 852 - static irqreturn_t 853 - msmsdcc_irq(int irq, void *dev_id) 854 - { 855 - struct msmsdcc_host *host = dev_id; 856 - void __iomem *base = host->base; 857 - u32 status; 858 - int ret = 0; 859 - int cardint = 0; 860 - 861 - spin_lock(&host->lock); 862 - 863 - do { 864 - status = msmsdcc_readl(host, MMCISTATUS); 865 - status &= msmsdcc_readl(host, MMCIMASK0); 866 - if ((status & (~MCI_IRQ_PIO)) == 0) 867 - break; 868 - msmsdcc_writel(host, status, MMCICLEAR); 869 - 870 - if (status & MCI_SDIOINTR) 871 - status &= ~MCI_SDIOINTR; 872 - 873 - if (!status) 874 - break; 875 - 876 - msmsdcc_handle_irq_data(host, status, base); 877 - 878 - if (status & MCI_SDIOINTOPER) { 879 - cardint = 1; 880 - status &= ~MCI_SDIOINTOPER; 881 - } 882 - ret = 1; 883 - } while (status); 884 - 885 - spin_unlock(&host->lock); 886 - 887 - /* 888 - * We have to delay handling the card interrupt as it calls 889 - * back into the driver. 890 - */ 891 - if (cardint) 892 - mmc_signal_sdio_irq(host->mmc); 893 - 894 - return IRQ_RETVAL(ret); 895 - } 896 - 897 - static void 898 - msmsdcc_request(struct mmc_host *mmc, struct mmc_request *mrq) 899 - { 900 - struct msmsdcc_host *host = mmc_priv(mmc); 901 - unsigned long flags; 902 - 903 - WARN_ON(host->curr.mrq != NULL); 904 - WARN_ON(host->pwr == 0); 905 - 906 - spin_lock_irqsave(&host->lock, flags); 907 - 908 - host->stats.reqs++; 909 - 910 - if (host->eject) { 911 - if (mrq->data && !(mrq->data->flags & MMC_DATA_READ)) { 912 - mrq->cmd->error = 0; 913 - mrq->data->bytes_xfered = mrq->data->blksz * 914 - mrq->data->blocks; 915 - } else 916 - mrq->cmd->error = -ENOMEDIUM; 917 - 918 - spin_unlock_irqrestore(&host->lock, flags); 919 - mmc_request_done(mmc, mrq); 920 - return; 921 - } 922 - 923 - msmsdcc_enable_clocks(host); 924 - 925 - host->curr.mrq = mrq; 926 - 927 - if (mrq->data && mrq->data->flags & MMC_DATA_READ) 928 - /* Queue/read data, daisy-chain command when data starts */ 929 - msmsdcc_start_data(host, mrq->data, mrq->cmd, 0); 930 - else 931 - msmsdcc_start_command(host, mrq->cmd, 0); 932 - 933 - if (host->cmdpoll && !msmsdcc_spin_on_status(host, 934 - MCI_CMDRESPEND|MCI_CMDCRCFAIL|MCI_CMDTIMEOUT, 935 - CMD_SPINMAX)) { 936 - uint32_t status = msmsdcc_readl(host, MMCISTATUS); 937 - msmsdcc_do_cmdirq(host, status); 938 - msmsdcc_writel(host, 939 - MCI_CMDRESPEND | MCI_CMDCRCFAIL | MCI_CMDTIMEOUT, 940 - MMCICLEAR); 941 - host->stats.cmdpoll_hits++; 942 - } else { 943 - host->stats.cmdpoll_misses++; 944 - } 945 - spin_unlock_irqrestore(&host->lock, flags); 946 - } 947 - 948 - static void msmsdcc_setup_gpio(struct msmsdcc_host *host, bool enable) 949 - { 950 - struct msm_mmc_gpio_data *curr; 951 - int i, rc = 0; 952 - 953 - if (!host->plat->gpio_data || host->gpio_config_status == enable) 954 - return; 955 - 956 - curr = host->plat->gpio_data; 957 - for (i = 0; i < curr->size; i++) { 958 - if (enable) { 959 - rc = gpio_request(curr->gpio[i].no, 960 - curr->gpio[i].name); 961 - if (rc) { 962 - pr_err("%s: gpio_request(%d, %s) failed %d\n", 963 - mmc_hostname(host->mmc), 964 - curr->gpio[i].no, 965 - curr->gpio[i].name, rc); 966 - goto free_gpios; 967 - } 968 - } else { 969 - gpio_free(curr->gpio[i].no); 970 - } 971 - } 972 - host->gpio_config_status = enable; 973 - return; 974 - 975 - free_gpios: 976 - for (; i >= 0; i--) 977 - gpio_free(curr->gpio[i].no); 978 - } 979 - 980 - static void 981 - msmsdcc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 982 - { 983 - struct msmsdcc_host *host = mmc_priv(mmc); 984 - u32 clk = 0, pwr = 0; 985 - int rc; 986 - unsigned long flags; 987 - 988 - spin_lock_irqsave(&host->lock, flags); 989 - 990 - msmsdcc_enable_clocks(host); 991 - 992 - spin_unlock_irqrestore(&host->lock, flags); 993 - 994 - if (ios->clock) { 995 - if (ios->clock != host->clk_rate) { 996 - rc = clk_set_rate(host->clk, ios->clock); 997 - if (rc < 0) 998 - pr_err("%s: Error setting clock rate (%d)\n", 999 - mmc_hostname(host->mmc), rc); 1000 - else 1001 - host->clk_rate = ios->clock; 1002 - } 1003 - clk |= MCI_CLK_ENABLE; 1004 - } 1005 - 1006 - if (ios->bus_width == MMC_BUS_WIDTH_4) 1007 - clk |= (2 << 10); /* Set WIDEBUS */ 1008 - 1009 - if (ios->clock > 400000 && msmsdcc_pwrsave) 1010 - clk |= (1 << 9); /* PWRSAVE */ 1011 - 1012 - clk |= (1 << 12); /* FLOW_ENA */ 1013 - clk |= (1 << 15); /* feedback clock */ 1014 - 1015 - if (host->plat->translate_vdd) 1016 - pwr |= host->plat->translate_vdd(mmc_dev(mmc), ios->vdd); 1017 - 1018 - switch (ios->power_mode) { 1019 - case MMC_POWER_OFF: 1020 - msmsdcc_setup_gpio(host, false); 1021 - break; 1022 - case MMC_POWER_UP: 1023 - pwr |= MCI_PWR_UP; 1024 - msmsdcc_setup_gpio(host, true); 1025 - break; 1026 - case MMC_POWER_ON: 1027 - pwr |= MCI_PWR_ON; 1028 - break; 1029 - } 1030 - 1031 - if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN) 1032 - pwr |= MCI_OD; 1033 - 1034 - msmsdcc_writel(host, clk, MMCICLOCK); 1035 - 1036 - if (host->pwr != pwr) { 1037 - host->pwr = pwr; 1038 - msmsdcc_writel(host, pwr, MMCIPOWER); 1039 - } 1040 - #if BUSCLK_PWRSAVE 1041 - spin_lock_irqsave(&host->lock, flags); 1042 - msmsdcc_disable_clocks(host, 1); 1043 - spin_unlock_irqrestore(&host->lock, flags); 1044 - #endif 1045 - } 1046 - 1047 - static void msmsdcc_enable_sdio_irq(struct mmc_host *mmc, int enable) 1048 - { 1049 - struct msmsdcc_host *host = mmc_priv(mmc); 1050 - unsigned long flags; 1051 - u32 status; 1052 - 1053 - spin_lock_irqsave(&host->lock, flags); 1054 - if (msmsdcc_sdioirq == 1) { 1055 - status = msmsdcc_readl(host, MMCIMASK0); 1056 - if (enable) 1057 - status |= MCI_SDIOINTOPERMASK; 1058 - else 1059 - status &= ~MCI_SDIOINTOPERMASK; 1060 - host->saved_irq0mask = status; 1061 - msmsdcc_writel(host, status, MMCIMASK0); 1062 - } 1063 - spin_unlock_irqrestore(&host->lock, flags); 1064 - } 1065 - 1066 - static void msmsdcc_init_card(struct mmc_host *mmc, struct mmc_card *card) 1067 - { 1068 - struct msmsdcc_host *host = mmc_priv(mmc); 1069 - 1070 - if (host->plat->init_card) 1071 - host->plat->init_card(card); 1072 - } 1073 - 1074 - static const struct mmc_host_ops msmsdcc_ops = { 1075 - .request = msmsdcc_request, 1076 - .set_ios = msmsdcc_set_ios, 1077 - .enable_sdio_irq = msmsdcc_enable_sdio_irq, 1078 - .init_card = msmsdcc_init_card, 1079 - }; 1080 - 1081 - static void 1082 - msmsdcc_check_status(unsigned long data) 1083 - { 1084 - struct msmsdcc_host *host = (struct msmsdcc_host *)data; 1085 - unsigned int status; 1086 - 1087 - if (!host->plat->status) { 1088 - mmc_detect_change(host->mmc, 0); 1089 - goto out; 1090 - } 1091 - 1092 - status = host->plat->status(mmc_dev(host->mmc)); 1093 - host->eject = !status; 1094 - if (status ^ host->oldstat) { 1095 - pr_info("%s: Slot status change detected (%d -> %d)\n", 1096 - mmc_hostname(host->mmc), host->oldstat, status); 1097 - if (status) 1098 - mmc_detect_change(host->mmc, (5 * HZ) / 2); 1099 - else 1100 - mmc_detect_change(host->mmc, 0); 1101 - } 1102 - 1103 - host->oldstat = status; 1104 - 1105 - out: 1106 - if (host->timer.function) 1107 - mod_timer(&host->timer, jiffies + HZ); 1108 - } 1109 - 1110 - static irqreturn_t 1111 - msmsdcc_platform_status_irq(int irq, void *dev_id) 1112 - { 1113 - struct msmsdcc_host *host = dev_id; 1114 - 1115 - pr_debug("%s: %d\n", __func__, irq); 1116 - msmsdcc_check_status((unsigned long) host); 1117 - return IRQ_HANDLED; 1118 - } 1119 - 1120 - static void 1121 - msmsdcc_status_notify_cb(int card_present, void *dev_id) 1122 - { 1123 - struct msmsdcc_host *host = dev_id; 1124 - 1125 - pr_debug("%s: card_present %d\n", mmc_hostname(host->mmc), 1126 - card_present); 1127 - msmsdcc_check_status((unsigned long) host); 1128 - } 1129 - 1130 - static void 1131 - msmsdcc_busclk_expired(unsigned long _data) 1132 - { 1133 - struct msmsdcc_host *host = (struct msmsdcc_host *) _data; 1134 - 1135 - if (host->clks_on) 1136 - msmsdcc_disable_clocks(host, 0); 1137 - } 1138 - 1139 - static int 1140 - msmsdcc_init_dma(struct msmsdcc_host *host) 1141 - { 1142 - memset(&host->dma, 0, sizeof(struct msmsdcc_dma_data)); 1143 - host->dma.host = host; 1144 - host->dma.channel = -1; 1145 - 1146 - if (!host->dmares) 1147 - return -ENODEV; 1148 - 1149 - host->dma.nc = dma_alloc_coherent(NULL, 1150 - sizeof(struct msmsdcc_nc_dmadata), 1151 - &host->dma.nc_busaddr, 1152 - GFP_KERNEL); 1153 - if (host->dma.nc == NULL) { 1154 - pr_err("Unable to allocate DMA buffer\n"); 1155 - return -ENOMEM; 1156 - } 1157 - memset(host->dma.nc, 0x00, sizeof(struct msmsdcc_nc_dmadata)); 1158 - host->dma.cmd_busaddr = host->dma.nc_busaddr; 1159 - host->dma.cmdptr_busaddr = host->dma.nc_busaddr + 1160 - offsetof(struct msmsdcc_nc_dmadata, cmdptr); 1161 - host->dma.channel = host->dmares->start; 1162 - 1163 - return 0; 1164 - } 1165 - 1166 - static int 1167 - msmsdcc_probe(struct platform_device *pdev) 1168 - { 1169 - struct msm_mmc_platform_data *plat = pdev->dev.platform_data; 1170 - struct msmsdcc_host *host; 1171 - struct mmc_host *mmc; 1172 - struct resource *cmd_irqres = NULL; 1173 - struct resource *stat_irqres = NULL; 1174 - struct resource *memres = NULL; 1175 - struct resource *dmares = NULL; 1176 - int ret; 1177 - 1178 - /* must have platform data */ 1179 - if (!plat) { 1180 - pr_err("%s: Platform data not available\n", __func__); 1181 - ret = -EINVAL; 1182 - goto out; 1183 - } 1184 - 1185 - if (pdev->id < 1 || pdev->id > 4) 1186 - return -EINVAL; 1187 - 1188 - if (pdev->resource == NULL || pdev->num_resources < 2) { 1189 - pr_err("%s: Invalid resource\n", __func__); 1190 - return -ENXIO; 1191 - } 1192 - 1193 - memres = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1194 - dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 1195 - cmd_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, 1196 - "cmd_irq"); 1197 - stat_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, 1198 - "status_irq"); 1199 - 1200 - if (!cmd_irqres || !memres) { 1201 - pr_err("%s: Invalid resource\n", __func__); 1202 - return -ENXIO; 1203 - } 1204 - 1205 - /* 1206 - * Setup our host structure 1207 - */ 1208 - 1209 - mmc = mmc_alloc_host(sizeof(struct msmsdcc_host), &pdev->dev); 1210 - if (!mmc) { 1211 - ret = -ENOMEM; 1212 - goto out; 1213 - } 1214 - 1215 - host = mmc_priv(mmc); 1216 - host->pdev_id = pdev->id; 1217 - host->plat = plat; 1218 - host->mmc = mmc; 1219 - host->curr.cmd = NULL; 1220 - init_timer(&host->busclk_timer); 1221 - host->busclk_timer.data = (unsigned long) host; 1222 - host->busclk_timer.function = msmsdcc_busclk_expired; 1223 - 1224 - 1225 - host->cmdpoll = 1; 1226 - 1227 - host->base = ioremap(memres->start, PAGE_SIZE); 1228 - if (!host->base) { 1229 - ret = -ENOMEM; 1230 - goto host_free; 1231 - } 1232 - 1233 - host->cmd_irqres = cmd_irqres; 1234 - host->memres = memres; 1235 - host->dmares = dmares; 1236 - spin_lock_init(&host->lock); 1237 - 1238 - tasklet_init(&host->dma_tlet, msmsdcc_dma_complete_tlet, 1239 - (unsigned long)host); 1240 - 1241 - /* 1242 - * Setup DMA 1243 - */ 1244 - if (host->dmares) { 1245 - ret = msmsdcc_init_dma(host); 1246 - if (ret) 1247 - goto ioremap_free; 1248 - } else { 1249 - host->dma.channel = -1; 1250 - } 1251 - 1252 - /* Get our clocks */ 1253 - host->pclk = clk_get(&pdev->dev, "sdc_pclk"); 1254 - if (IS_ERR(host->pclk)) { 1255 - ret = PTR_ERR(host->pclk); 1256 - goto dma_free; 1257 - } 1258 - 1259 - host->clk = clk_get(&pdev->dev, "sdc_clk"); 1260 - if (IS_ERR(host->clk)) { 1261 - ret = PTR_ERR(host->clk); 1262 - goto pclk_put; 1263 - } 1264 - 1265 - ret = clk_set_rate(host->clk, msmsdcc_fmin); 1266 - if (ret) { 1267 - pr_err("%s: Clock rate set failed (%d)\n", __func__, ret); 1268 - goto clk_put; 1269 - } 1270 - 1271 - ret = clk_prepare(host->pclk); 1272 - if (ret) 1273 - goto clk_put; 1274 - 1275 - ret = clk_prepare(host->clk); 1276 - if (ret) 1277 - goto clk_unprepare_p; 1278 - 1279 - /* Enable clocks */ 1280 - ret = msmsdcc_enable_clocks(host); 1281 - if (ret) 1282 - goto clk_unprepare; 1283 - 1284 - host->pclk_rate = clk_get_rate(host->pclk); 1285 - host->clk_rate = clk_get_rate(host->clk); 1286 - 1287 - /* 1288 - * Setup MMC host structure 1289 - */ 1290 - mmc->ops = &msmsdcc_ops; 1291 - mmc->f_min = msmsdcc_fmin; 1292 - mmc->f_max = msmsdcc_fmax; 1293 - mmc->ocr_avail = plat->ocr_mask; 1294 - 1295 - if (msmsdcc_4bit) 1296 - mmc->caps |= MMC_CAP_4_BIT_DATA; 1297 - if (msmsdcc_sdioirq) 1298 - mmc->caps |= MMC_CAP_SDIO_IRQ; 1299 - mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED; 1300 - 1301 - mmc->max_segs = NR_SG; 1302 - mmc->max_blk_size = 4096; /* MCI_DATA_CTL BLOCKSIZE up to 4096 */ 1303 - mmc->max_blk_count = 65536; 1304 - 1305 - mmc->max_req_size = 33554432; /* MCI_DATA_LENGTH is 25 bits */ 1306 - mmc->max_seg_size = mmc->max_req_size; 1307 - 1308 - msmsdcc_writel(host, 0, MMCIMASK0); 1309 - msmsdcc_writel(host, 0x5e007ff, MMCICLEAR); 1310 - 1311 - msmsdcc_writel(host, MCI_IRQENABLE, MMCIMASK0); 1312 - host->saved_irq0mask = MCI_IRQENABLE; 1313 - 1314 - /* 1315 - * Setup card detect change 1316 - */ 1317 - 1318 - memset(&host->timer, 0, sizeof(host->timer)); 1319 - 1320 - if (stat_irqres && !(stat_irqres->flags & IORESOURCE_DISABLED)) { 1321 - unsigned long irqflags = IRQF_SHARED | 1322 - (stat_irqres->flags & IRQF_TRIGGER_MASK); 1323 - 1324 - host->stat_irq = stat_irqres->start; 1325 - ret = request_irq(host->stat_irq, 1326 - msmsdcc_platform_status_irq, 1327 - irqflags, 1328 - DRIVER_NAME " (slot)", 1329 - host); 1330 - if (ret) { 1331 - pr_err("%s: Unable to get slot IRQ %d (%d)\n", 1332 - mmc_hostname(mmc), host->stat_irq, ret); 1333 - goto clk_disable; 1334 - } 1335 - } else if (plat->register_status_notify) { 1336 - plat->register_status_notify(msmsdcc_status_notify_cb, host); 1337 - } else if (!plat->status) 1338 - pr_err("%s: No card detect facilities available\n", 1339 - mmc_hostname(mmc)); 1340 - else { 1341 - init_timer(&host->timer); 1342 - host->timer.data = (unsigned long)host; 1343 - host->timer.function = msmsdcc_check_status; 1344 - host->timer.expires = jiffies + HZ; 1345 - add_timer(&host->timer); 1346 - } 1347 - 1348 - if (plat->status) { 1349 - host->oldstat = host->plat->status(mmc_dev(host->mmc)); 1350 - host->eject = !host->oldstat; 1351 - } 1352 - 1353 - ret = request_irq(cmd_irqres->start, msmsdcc_irq, IRQF_SHARED, 1354 - DRIVER_NAME " (cmd)", host); 1355 - if (ret) 1356 - goto stat_irq_free; 1357 - 1358 - ret = request_irq(cmd_irqres->start, msmsdcc_pio_irq, IRQF_SHARED, 1359 - DRIVER_NAME " (pio)", host); 1360 - if (ret) 1361 - goto cmd_irq_free; 1362 - 1363 - platform_set_drvdata(pdev, mmc); 1364 - mmc_add_host(mmc); 1365 - 1366 - pr_info("%s: Qualcomm MSM SDCC at 0x%016llx irq %d,%d dma %d\n", 1367 - mmc_hostname(mmc), (unsigned long long)memres->start, 1368 - (unsigned int) cmd_irqres->start, 1369 - (unsigned int) host->stat_irq, host->dma.channel); 1370 - pr_info("%s: 4 bit data mode %s\n", mmc_hostname(mmc), 1371 - (mmc->caps & MMC_CAP_4_BIT_DATA ? "enabled" : "disabled")); 1372 - pr_info("%s: MMC clock %u -> %u Hz, PCLK %u Hz\n", 1373 - mmc_hostname(mmc), msmsdcc_fmin, msmsdcc_fmax, host->pclk_rate); 1374 - pr_info("%s: Slot eject status = %d\n", mmc_hostname(mmc), host->eject); 1375 - pr_info("%s: Power save feature enable = %d\n", 1376 - mmc_hostname(mmc), msmsdcc_pwrsave); 1377 - 1378 - if (host->dma.channel != -1) { 1379 - pr_info("%s: DM non-cached buffer at %p, dma_addr 0x%.8x\n", 1380 - mmc_hostname(mmc), host->dma.nc, host->dma.nc_busaddr); 1381 - pr_info("%s: DM cmd busaddr 0x%.8x, cmdptr busaddr 0x%.8x\n", 1382 - mmc_hostname(mmc), host->dma.cmd_busaddr, 1383 - host->dma.cmdptr_busaddr); 1384 - } else 1385 - pr_info("%s: PIO transfer enabled\n", mmc_hostname(mmc)); 1386 - if (host->timer.function) 1387 - pr_info("%s: Polling status mode enabled\n", mmc_hostname(mmc)); 1388 - 1389 - return 0; 1390 - cmd_irq_free: 1391 - free_irq(cmd_irqres->start, host); 1392 - stat_irq_free: 1393 - if (host->stat_irq) 1394 - free_irq(host->stat_irq, host); 1395 - clk_disable: 1396 - msmsdcc_disable_clocks(host, 0); 1397 - clk_unprepare: 1398 - clk_unprepare(host->clk); 1399 - clk_unprepare_p: 1400 - clk_unprepare(host->pclk); 1401 - clk_put: 1402 - clk_put(host->clk); 1403 - pclk_put: 1404 - clk_put(host->pclk); 1405 - dma_free: 1406 - if (host->dmares) 1407 - dma_free_coherent(NULL, sizeof(struct msmsdcc_nc_dmadata), 1408 - host->dma.nc, host->dma.nc_busaddr); 1409 - ioremap_free: 1410 - tasklet_kill(&host->dma_tlet); 1411 - iounmap(host->base); 1412 - host_free: 1413 - mmc_free_host(mmc); 1414 - out: 1415 - return ret; 1416 - } 1417 - 1418 - #ifdef CONFIG_PM 1419 - static int 1420 - msmsdcc_suspend(struct platform_device *dev, pm_message_t state) 1421 - { 1422 - struct mmc_host *mmc = platform_get_drvdata(dev); 1423 - 1424 - if (mmc) { 1425 - struct msmsdcc_host *host = mmc_priv(mmc); 1426 - 1427 - if (host->stat_irq) 1428 - disable_irq(host->stat_irq); 1429 - 1430 - msmsdcc_writel(host, 0, MMCIMASK0); 1431 - if (host->clks_on) 1432 - msmsdcc_disable_clocks(host, 0); 1433 - } 1434 - return 0; 1435 - } 1436 - 1437 - static int 1438 - msmsdcc_resume(struct platform_device *dev) 1439 - { 1440 - struct mmc_host *mmc = platform_get_drvdata(dev); 1441 - 1442 - if (mmc) { 1443 - struct msmsdcc_host *host = mmc_priv(mmc); 1444 - 1445 - msmsdcc_enable_clocks(host); 1446 - 1447 - msmsdcc_writel(host, host->saved_irq0mask, MMCIMASK0); 1448 - 1449 - if (host->stat_irq) 1450 - enable_irq(host->stat_irq); 1451 - #if BUSCLK_PWRSAVE 1452 - msmsdcc_disable_clocks(host, 1); 1453 - #endif 1454 - } 1455 - return 0; 1456 - } 1457 - #else 1458 - #define msmsdcc_suspend 0 1459 - #define msmsdcc_resume 0 1460 - #endif 1461 - 1462 - static struct platform_driver msmsdcc_driver = { 1463 - .probe = msmsdcc_probe, 1464 - .suspend = msmsdcc_suspend, 1465 - .resume = msmsdcc_resume, 1466 - .driver = { 1467 - .name = "msm_sdcc", 1468 - }, 1469 - }; 1470 - 1471 - module_platform_driver(msmsdcc_driver); 1472 - 1473 - MODULE_DESCRIPTION("Qualcomm MSM 7X00A Multimedia Card Interface driver"); 1474 - MODULE_LICENSE("GPL");
-256
drivers/mmc/host/msm_sdcc.h
··· 1 - /* 2 - * linux/drivers/mmc/host/msmsdcc.h - QCT MSM7K SDC Controller 3 - * 4 - * Copyright (C) 2008 Google, All Rights Reserved. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - * 10 - * - Based on mmci.h 11 - */ 12 - 13 - #ifndef _MSM_SDCC_H 14 - #define _MSM_SDCC_H 15 - 16 - #define MSMSDCC_CRCI_SDC1 6 17 - #define MSMSDCC_CRCI_SDC2 7 18 - #define MSMSDCC_CRCI_SDC3 12 19 - #define MSMSDCC_CRCI_SDC4 13 20 - 21 - #define MMCIPOWER 0x000 22 - #define MCI_PWR_OFF 0x00 23 - #define MCI_PWR_UP 0x02 24 - #define MCI_PWR_ON 0x03 25 - #define MCI_OD (1 << 6) 26 - 27 - #define MMCICLOCK 0x004 28 - #define MCI_CLK_ENABLE (1 << 8) 29 - #define MCI_CLK_PWRSAVE (1 << 9) 30 - #define MCI_CLK_WIDEBUS (1 << 10) 31 - #define MCI_CLK_FLOWENA (1 << 12) 32 - #define MCI_CLK_INVERTOUT (1 << 13) 33 - #define MCI_CLK_SELECTIN (1 << 14) 34 - 35 - #define MMCIARGUMENT 0x008 36 - #define MMCICOMMAND 0x00c 37 - #define MCI_CPSM_RESPONSE (1 << 6) 38 - #define MCI_CPSM_LONGRSP (1 << 7) 39 - #define MCI_CPSM_INTERRUPT (1 << 8) 40 - #define MCI_CPSM_PENDING (1 << 9) 41 - #define MCI_CPSM_ENABLE (1 << 10) 42 - #define MCI_CPSM_PROGENA (1 << 11) 43 - #define MCI_CSPM_DATCMD (1 << 12) 44 - #define MCI_CSPM_MCIABORT (1 << 13) 45 - #define MCI_CSPM_CCSENABLE (1 << 14) 46 - #define MCI_CSPM_CCSDISABLE (1 << 15) 47 - 48 - 49 - #define MMCIRESPCMD 0x010 50 - #define MMCIRESPONSE0 0x014 51 - #define MMCIRESPONSE1 0x018 52 - #define MMCIRESPONSE2 0x01c 53 - #define MMCIRESPONSE3 0x020 54 - #define MMCIDATATIMER 0x024 55 - #define MMCIDATALENGTH 0x028 56 - 57 - #define MMCIDATACTRL 0x02c 58 - #define MCI_DPSM_ENABLE (1 << 0) 59 - #define MCI_DPSM_DIRECTION (1 << 1) 60 - #define MCI_DPSM_MODE (1 << 2) 61 - #define MCI_DPSM_DMAENABLE (1 << 3) 62 - 63 - #define MMCIDATACNT 0x030 64 - #define MMCISTATUS 0x034 65 - #define MCI_CMDCRCFAIL (1 << 0) 66 - #define MCI_DATACRCFAIL (1 << 1) 67 - #define MCI_CMDTIMEOUT (1 << 2) 68 - #define MCI_DATATIMEOUT (1 << 3) 69 - #define MCI_TXUNDERRUN (1 << 4) 70 - #define MCI_RXOVERRUN (1 << 5) 71 - #define MCI_CMDRESPEND (1 << 6) 72 - #define MCI_CMDSENT (1 << 7) 73 - #define MCI_DATAEND (1 << 8) 74 - #define MCI_DATABLOCKEND (1 << 10) 75 - #define MCI_CMDACTIVE (1 << 11) 76 - #define MCI_TXACTIVE (1 << 12) 77 - #define MCI_RXACTIVE (1 << 13) 78 - #define MCI_TXFIFOHALFEMPTY (1 << 14) 79 - #define MCI_RXFIFOHALFFULL (1 << 15) 80 - #define MCI_TXFIFOFULL (1 << 16) 81 - #define MCI_RXFIFOFULL (1 << 17) 82 - #define MCI_TXFIFOEMPTY (1 << 18) 83 - #define MCI_RXFIFOEMPTY (1 << 19) 84 - #define MCI_TXDATAAVLBL (1 << 20) 85 - #define MCI_RXDATAAVLBL (1 << 21) 86 - #define MCI_SDIOINTR (1 << 22) 87 - #define MCI_PROGDONE (1 << 23) 88 - #define MCI_ATACMDCOMPL (1 << 24) 89 - #define MCI_SDIOINTOPER (1 << 25) 90 - #define MCI_CCSTIMEOUT (1 << 26) 91 - 92 - #define MMCICLEAR 0x038 93 - #define MCI_CMDCRCFAILCLR (1 << 0) 94 - #define MCI_DATACRCFAILCLR (1 << 1) 95 - #define MCI_CMDTIMEOUTCLR (1 << 2) 96 - #define MCI_DATATIMEOUTCLR (1 << 3) 97 - #define MCI_TXUNDERRUNCLR (1 << 4) 98 - #define MCI_RXOVERRUNCLR (1 << 5) 99 - #define MCI_CMDRESPENDCLR (1 << 6) 100 - #define MCI_CMDSENTCLR (1 << 7) 101 - #define MCI_DATAENDCLR (1 << 8) 102 - #define MCI_DATABLOCKENDCLR (1 << 10) 103 - 104 - #define MMCIMASK0 0x03c 105 - #define MCI_CMDCRCFAILMASK (1 << 0) 106 - #define MCI_DATACRCFAILMASK (1 << 1) 107 - #define MCI_CMDTIMEOUTMASK (1 << 2) 108 - #define MCI_DATATIMEOUTMASK (1 << 3) 109 - #define MCI_TXUNDERRUNMASK (1 << 4) 110 - #define MCI_RXOVERRUNMASK (1 << 5) 111 - #define MCI_CMDRESPENDMASK (1 << 6) 112 - #define MCI_CMDSENTMASK (1 << 7) 113 - #define MCI_DATAENDMASK (1 << 8) 114 - #define MCI_DATABLOCKENDMASK (1 << 10) 115 - #define MCI_CMDACTIVEMASK (1 << 11) 116 - #define MCI_TXACTIVEMASK (1 << 12) 117 - #define MCI_RXACTIVEMASK (1 << 13) 118 - #define MCI_TXFIFOHALFEMPTYMASK (1 << 14) 119 - #define MCI_RXFIFOHALFFULLMASK (1 << 15) 120 - #define MCI_TXFIFOFULLMASK (1 << 16) 121 - #define MCI_RXFIFOFULLMASK (1 << 17) 122 - #define MCI_TXFIFOEMPTYMASK (1 << 18) 123 - #define MCI_RXFIFOEMPTYMASK (1 << 19) 124 - #define MCI_TXDATAAVLBLMASK (1 << 20) 125 - #define MCI_RXDATAAVLBLMASK (1 << 21) 126 - #define MCI_SDIOINTMASK (1 << 22) 127 - #define MCI_PROGDONEMASK (1 << 23) 128 - #define MCI_ATACMDCOMPLMASK (1 << 24) 129 - #define MCI_SDIOINTOPERMASK (1 << 25) 130 - #define MCI_CCSTIMEOUTMASK (1 << 26) 131 - 132 - #define MMCIMASK1 0x040 133 - #define MMCIFIFOCNT 0x044 134 - #define MCICCSTIMER 0x058 135 - 136 - #define MMCIFIFO 0x080 /* to 0x0bc */ 137 - 138 - #define MCI_IRQENABLE \ 139 - (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \ 140 - MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ 141 - MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_DATAENDMASK|MCI_PROGDONEMASK) 142 - 143 - #define MCI_IRQ_PIO \ 144 - (MCI_RXDATAAVLBLMASK | MCI_TXDATAAVLBLMASK | MCI_RXFIFOEMPTYMASK | \ 145 - MCI_TXFIFOEMPTYMASK | MCI_RXFIFOFULLMASK | MCI_TXFIFOFULLMASK | \ 146 - MCI_RXFIFOHALFFULLMASK | MCI_TXFIFOHALFEMPTYMASK | \ 147 - MCI_RXACTIVEMASK | MCI_TXACTIVEMASK) 148 - /* 149 - * The size of the FIFO in bytes. 150 - */ 151 - #define MCI_FIFOSIZE (16*4) 152 - 153 - #define MCI_FIFOHALFSIZE (MCI_FIFOSIZE / 2) 154 - 155 - #define NR_SG 32 156 - 157 - struct clk; 158 - 159 - struct msmsdcc_nc_dmadata { 160 - dmov_box cmd[NR_SG]; 161 - uint32_t cmdptr; 162 - }; 163 - 164 - struct msmsdcc_dma_data { 165 - struct msmsdcc_nc_dmadata *nc; 166 - dma_addr_t nc_busaddr; 167 - dma_addr_t cmd_busaddr; 168 - dma_addr_t cmdptr_busaddr; 169 - 170 - struct msm_dmov_cmd hdr; 171 - enum dma_data_direction dir; 172 - 173 - struct scatterlist *sg; 174 - int num_ents; 175 - 176 - int channel; 177 - struct msmsdcc_host *host; 178 - int busy; /* Set if DM is busy */ 179 - int active; 180 - unsigned int result; 181 - struct msm_dmov_errdata err; 182 - }; 183 - 184 - struct msmsdcc_pio_data { 185 - struct scatterlist *sg; 186 - unsigned int sg_len; 187 - unsigned int sg_off; 188 - }; 189 - 190 - struct msmsdcc_curr_req { 191 - struct mmc_request *mrq; 192 - struct mmc_command *cmd; 193 - struct mmc_data *data; 194 - unsigned int xfer_size; /* Total data size */ 195 - unsigned int xfer_remain; /* Bytes remaining to send */ 196 - unsigned int data_xfered; /* Bytes acked by BLKEND irq */ 197 - int got_dataend; 198 - int user_pages; 199 - }; 200 - 201 - struct msmsdcc_stats { 202 - unsigned int reqs; 203 - unsigned int cmds; 204 - unsigned int cmdpoll_hits; 205 - unsigned int cmdpoll_misses; 206 - }; 207 - 208 - struct msmsdcc_host { 209 - struct resource *cmd_irqres; 210 - struct resource *memres; 211 - struct resource *dmares; 212 - void __iomem *base; 213 - int pdev_id; 214 - unsigned int stat_irq; 215 - 216 - struct msmsdcc_curr_req curr; 217 - 218 - struct mmc_host *mmc; 219 - struct clk *clk; /* main MMC bus clock */ 220 - struct clk *pclk; /* SDCC peripheral bus clock */ 221 - unsigned int clks_on; /* set if clocks are enabled */ 222 - struct timer_list busclk_timer; 223 - 224 - unsigned int eject; /* eject state */ 225 - 226 - spinlock_t lock; 227 - 228 - unsigned int clk_rate; /* Current clock rate */ 229 - unsigned int pclk_rate; 230 - 231 - u32 pwr; 232 - u32 saved_irq0mask; /* MMCIMASK0 reg value */ 233 - struct msm_mmc_platform_data *plat; 234 - 235 - struct timer_list timer; 236 - unsigned int oldstat; 237 - 238 - struct msmsdcc_dma_data dma; 239 - struct msmsdcc_pio_data pio; 240 - int cmdpoll; 241 - struct msmsdcc_stats stats; 242 - 243 - struct tasklet_struct dma_tlet; 244 - /* Command parameters */ 245 - unsigned int cmd_timeout; 246 - unsigned int cmd_pio_irqmask; 247 - unsigned int cmd_datactrl; 248 - struct mmc_command *cmd_cmd; 249 - u32 cmd_c; 250 - bool gpio_config_status; 251 - 252 - bool prog_scan; 253 - bool prog_enable; 254 - }; 255 - 256 - #endif
+1
drivers/pcmcia/Kconfig
··· 275 275 276 276 config AT91_CF 277 277 tristate "AT91 CompactFlash Controller" 278 + depends on PCI 278 279 depends on PCMCIA && ARCH_AT91 279 280 depends on !ARCH_MULTIPLATFORM 280 281 help
+7 -6
drivers/pcmcia/at91_cf.c
··· 317 317 } else 318 318 cf->socket.pci_irq = nr_irqs + 1; 319 319 320 - /* pcmcia layer only remaps "real" memory not iospace */ 321 - cf->socket.io_offset = (unsigned long) devm_ioremap(&pdev->dev, 322 - cf->phys_baseaddr + CF_IO_PHYS, SZ_2K); 323 - if (!cf->socket.io_offset) { 324 - status = -ENXIO; 320 + /* 321 + * pcmcia layer only remaps "real" memory not iospace 322 + * io_offset is set to 0x10000 to avoid the check in static_find_io(). 323 + * */ 324 + cf->socket.io_offset = 0x10000; 325 + status = pci_ioremap_io(0x10000, cf->phys_baseaddr + CF_IO_PHYS); 326 + if (status) 325 327 goto fail0a; 326 - } 327 328 328 329 /* reserve chip-select regions */ 329 330 if (!devm_request_mem_region(&pdev->dev, io->start, resource_size(io), "at91_cf")) {
-27
include/linux/platform_data/mmc-msm_sdcc.h
··· 1 - #ifndef __MMC_MSM_SDCC_H 2 - #define __MMC_MSM_SDCC_H 3 - 4 - #include <linux/mmc/host.h> 5 - #include <linux/mmc/card.h> 6 - #include <linux/mmc/sdio_func.h> 7 - 8 - struct msm_mmc_gpio { 9 - unsigned no; 10 - const char *name; 11 - }; 12 - 13 - struct msm_mmc_gpio_data { 14 - struct msm_mmc_gpio *gpio; 15 - u8 size; 16 - }; 17 - 18 - struct msm_mmc_platform_data { 19 - unsigned int ocr_mask; /* available voltages */ 20 - u32 (*translate_vdd)(struct device *, unsigned int); 21 - unsigned int (*status)(struct device *); 22 - int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id); 23 - struct msm_mmc_gpio_data *gpio_data; 24 - void (*init_card)(struct mmc_card *card); 25 - }; 26 - 27 - #endif