Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 600c6edb07a40ec6c3faacca02dd6e63f72a347d Mon Sep 17 00:00:00 2001
- From: Adam Ford <aford173@gmail.com>
- Date: Tue, 8 Aug 2017 10:26:52 -0500
- Subject: [PATCH] Add updates for Logic PD AM37xx/DM37xx Torpedo + Wireless
- Signed-off-by: Adam Ford <aford173@gmail.com>
- diff --git a/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt b/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
- new file mode 100644
- index 0000000..5befb53
- --- /dev/null
- +++ b/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
- @@ -0,0 +1,18 @@
- +* OMAP PWM for dual-mode timers
- +
- +Required properties:
- +- compatible: Shall contain "ti,omap-dmtimer-pwm".
- +- ti,timers: phandle to PWM capable OMAP timer. See arm/omap/timer.txt for info
- + about these timers.
- +- #pwm-cells: Should be 3. See pwm.txt in this directory for a description of
- + the cells format.
- +
- +Optional properties:
- +- ti,prescaler: Should be a value between 0 and 7, see the timers datasheet
- +
- +Example:
- + pwm9: dmtimer-pwm@9 {
- + compatible = "ti,omap-dmtimer-pwm";
- + ti,timers = <&timer9>;
- + #pwm-cells = <3>;
- + };
- diff --git a/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts b/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
- new file mode 100644
- index 0000000..b936b23
- --- /dev/null
- +++ b/arch/arm/boot/dts/logicpd-som-lv-37xx-devkit.dts
- @@ -0,0 +1,268 @@
- +/*
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License version 2 as
- + * published by the Free Software Foundation.
- + */
- +
- +/dts-v1/;
- +
- +#include "omap36xx.dtsi"
- +#include "logicpd-som-lv.dtsi"
- +#include "omap-gpmc-smsc9221.dtsi"
- +
- +/ {
- + model = "LogicPD Zoom DM3730 SOM-LV Development Kit";
- + compatible = "logicpd,dm3730-som-lv-devkit", "ti,omap3630", "ti,omap3";
- +
- + gpio_keys {
- + compatible = "gpio-keys";
- + pinctrl-names = "default";
- + pinctrl-0 = <&gpio_key_pins>;
- +
- + sysboot2 {
- + label = "gpio3";
- + gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* gpio_111 / uP_GPIO_3 */
- + linux,code = <BTN_0>;
- + wakeup-source;
- + };
- + };
- +
- + sound {
- + compatible = "ti,omap-twl4030";
- + ti,model = "omap3logic";
- + ti,mcbsp = <&mcbsp2>;
- + };
- +
- + leds {
- + compatible = "gpio-leds";
- + pinctrl-names = "default";
- + pinctrl-0 = <&led_pins &led_pins_wkup>;
- +
- + led1 {
- + label = "led1";
- + gpios = <&gpio5 5 GPIO_ACTIVE_LOW>; /* gpio133 */
- + linux,default-trigger = "cpu0";
- + };
- +
- + led2 {
- + label = "led2";
- + gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; /* gpio11 */
- + linux,default-trigger = "none";
- + };
- + };
- +};
- +
- +&vaux1 {
- + regulator-min-microvolt = <3000000>;
- + regulator-max-microvolt = <3000000>;
- +};
- +
- +&vaux4 {
- + regulator-min-microvolt = <1800000>;
- + regulator-max-microvolt = <1800000>;
- +};
- +
- +&mcbsp2 {
- + status = "okay";
- +};
- +
- +&charger {
- + ti,bb-uvolt = <3200000>;
- + ti,bb-uamp = <150>;
- +};
- +
- +&gpmc {
- + ranges = <1 0 0x08000000 0x1000000>; /* CS1: 16MB for LAN9221 */
- +
- + ethernet@gpmc {
- + pinctrl-names = "default";
- + pinctrl-0 = <&lan9221_pins>;
- + interrupt-parent = <&gpio5>;
- + interrupts = <24 IRQ_TYPE_LEVEL_LOW>; /* gpio_152 */
- + reg = <1 0 0xff>;
- + };
- +};
- +
- +&vpll2 {
- + regulator-always-on;
- +};
- +
- +&dss {
- + status = "ok";
- + vdds_dsi-supply = <&vpll2>;
- + vdda_video-supply = <&video_reg>;
- + pinctrl-names = "default";
- + pinctrl-0 = <&dss_dpi_pins1>;
- + port {
- + dpi_out: endpoint {
- + remote-endpoint = <&lcd_in>;
- + data-lines = <16>;
- + };
- + };
- +};
- +
- +/ {
- + aliases {
- + display0 = &lcd0;
- + };
- +
- + video_reg: video_reg {
- + compatible = "regulator-fixed";
- + regulator-name = "fixed-supply";
- + regulator-min-microvolt = <3300000>;
- + regulator-max-microvolt = <3300000>;
- + };
- +
- + lcd0: display@0 {
- + compatible = "panel-dpi";
- + label = "28";
- + status = "okay";
- + /* default-on; */
- + pinctrl-names = "default";
- + pinctrl-0 = <&lcd_enable_pin>;
- + enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; /* gpio155, lcd INI */
- + port {
- + lcd_in: endpoint {
- + remote-endpoint = <&dpi_out>;
- + };
- + };
- +
- + panel-timing {
- + clock-frequency = <9000000>;
- + hactive = <480>;
- + vactive = <272>;
- + hfront-porch = <3>;
- + hback-porch = <2>;
- + hsync-len = <42>;
- + vback-porch = <3>;
- + vfront-porch = <4>;
- + vsync-len = <11>;
- + hsync-active = <0>;
- + vsync-active = <0>;
- + de-active = <1>;
- + pixelclk-active = <1>;
- + };
- + };
- +
- + bl: backlight {
- + compatible = "pwm-backlight";
- + pinctrl-names = "default";
- + pinctrl-0 = <&backlight_pins>;
- + pwms = <&twl_pwm 0 5000000>;
- + brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
- + default-brightness-level = <7>;
- + enable-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; /* gpio_8 */
- + };
- +};
- +
- +&mmc1 {
- + interrupts-extended = <&intc 83 &omap3_pmx_core 0x11a>;
- + pinctrl-names = "default";
- + pinctrl-0 = <&mmc1_pins &mmc1_cd>;
- + wp-gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>; /* gpio_126 */
- + cd-gpios = <&gpio4 14 IRQ_TYPE_LEVEL_LOW>; /* gpio_110 */
- + vmmc-supply = <&vmmc1>;
- + bus-width = <4>;
- + cap-power-off-card;
- +};
- +
- +&omap3_pmx_core {
- + gpio_key_pins: pinmux_gpio_key_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x212e, PIN_INPUT_PULLUP | MUX_MODE4) /* cam_xclkb.gpio_111 / uP_GPIO_3*/
- + >;
- + };
- +
- + led_pins: pinmux_led_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x215e, PIN_OUTPUT_PULLUP | MUX_MODE4) /* sdmmc2_dat1.gpio_133 / uP_GPIO_0 */
- + >;
- + };
- +
- + lan9221_pins: pinmux_lan9221_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x2184, PIN_INPUT_PULLUP | MUX_MODE4) /* mcbsp4_clkx.gpio_152 */
- + >;
- + };
- +
- + mmc1_pins: pinmux_mmc1_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x2144, PIN_OUTPUT | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
- + OMAP3_CORE1_IOPAD(0x2146, PIN_INPUT | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */
- + OMAP3_CORE1_IOPAD(0x2148, PIN_INPUT | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */
- + OMAP3_CORE1_IOPAD(0x214a, PIN_INPUT | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */
- + OMAP3_CORE1_IOPAD(0x214c, PIN_INPUT | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */
- + OMAP3_CORE1_IOPAD(0x214e, PIN_INPUT | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
- + OMAP3_CORE1_IOPAD(0x2132, PIN_INPUT_PULLUP | MUX_MODE4) /* cam_strobe.gpio_126 sdmmc1_wp*/
- + >;
- + };
- +
- + lcd_enable_pin: pinmux_lcd_enable_pin {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x218a, PIN_OUTPUT | PIN_OFF_OUTPUT_LOW | MUX_MODE4) /* mcbsp4_fs.gpio_155 */
- + >;
- + };
- +
- + dss_dpi_pins1: pinmux_dss_dpi_pins1 {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x20d4, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_pclk.dss_pclk */
- + OMAP3_CORE1_IOPAD(0x20d6, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_hsync.dss_hsync */
- + OMAP3_CORE1_IOPAD(0x20d8, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_vsync.dss_vsync */
- + OMAP3_CORE1_IOPAD(0x20da, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_acbias.dss_acbias */
- +
- + OMAP3_CORE1_IOPAD(0x20dc, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data0.dss_data0 */
- + OMAP3_CORE1_IOPAD(0x20de, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data1.dss_data1 */
- + OMAP3_CORE1_IOPAD(0x20e0, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data2.dss_data2 */
- + OMAP3_CORE1_IOPAD(0x20e2, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data3.dss_data3 */
- + OMAP3_CORE1_IOPAD(0x20e4, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data4.dss_data4 */
- + OMAP3_CORE1_IOPAD(0x20e6, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data5.dss_data5 */
- + OMAP3_CORE1_IOPAD(0x20e8, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data6.dss_data6 */
- + OMAP3_CORE1_IOPAD(0x20ea, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data7.dss_data7 */
- + OMAP3_CORE1_IOPAD(0x20ec, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data8.dss_data8 */
- + OMAP3_CORE1_IOPAD(0x20ee, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data9.dss_data9 */
- + OMAP3_CORE1_IOPAD(0x20f0, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data10.dss_data10 */
- + OMAP3_CORE1_IOPAD(0x20f2, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data11.dss_data11 */
- + OMAP3_CORE1_IOPAD(0x20f4, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data12.dss_data12 */
- + OMAP3_CORE1_IOPAD(0x20f6, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data13.dss_data13 */
- + OMAP3_CORE1_IOPAD(0x20f8, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data14.dss_data14 */
- + OMAP3_CORE1_IOPAD(0x20fa, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data15.dss_data15 */
- + >;
- + };
- +};
- +
- +&omap3_pmx_wkup {
- + led_pins_wkup: pinmux_led_pins_wkup {
- + pinctrl-single,pins = <
- + OMAP3_WKUP_IOPAD(0x2a24, PIN_OUTPUT_PULLUP | MUX_MODE4) /* jtag_emu0.gpio_11 / uP_GPIO_1 */
- + >;
- + };
- +
- + backlight_pins: pinmux_backlight_pins {
- + pinctrl-single,pins = <
- + OMAP3_WKUP_IOPAD(0x2a16, PIN_OUTPUT | PIN_OFF_OUTPUT_LOW | MUX_MODE4) /* sys_boot6.gpio_8 */
- + >;
- + };
- +
- + mmc1_cd: pinmux_mmc1_cd {
- + pinctrl-single,pins = <
- + OMAP3_WKUP_IOPAD(0x212c, PIN_INPUT_PULLUP | MUX_MODE4) /* cam_d11.gpio_110 */
- + >;
- + };
- +};
- +
- +
- +&uart1 {
- + interrupts-extended = <&intc 72 &omap3_pmx_core OMAP3_UART1_RX>;
- +};
- +
- +/* Wired to the tps65950 on the SOM, only the USB connector is on the devkit */
- +&usb_otg_hs {
- + pinctrl-names = "default";
- + pinctrl-0 = <&hsusb_otg_pins>;
- + interface-type = <0>;
- + usb-phy = <&usb2_phy>;
- + phys = <&usb2_phy>;
- + phy-names = "usb2-phy";
- + mode = <3>;
- + power = <50>;
- +};
- diff --git a/arch/arm/boot/dts/logicpd-som-lv.dtsi b/arch/arm/boot/dts/logicpd-som-lv.dtsi
- new file mode 100644
- index 0000000..365f39f
- --- /dev/null
- +++ b/arch/arm/boot/dts/logicpd-som-lv.dtsi
- @@ -0,0 +1,265 @@
- +/*
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License version 2 as
- + * published by the Free Software Foundation.
- + */
- +
- +#include <dt-bindings/input/input.h>
- +
- +/ {
- + cpus {
- + cpu@0 {
- + cpu0-supply = <&vcc>;
- + };
- + };
- +
- + wl12xx_vmmc: wl12xx_vmmc {
- + compatible = "regulator-fixed";
- + regulator-name = "vwl1271";
- + regulator-min-microvolt = <1800000>;
- + regulator-max-microvolt = <1800000>;
- + gpio = <&gpio1 3 0>; /* gpio_3 */
- + startup-delay-us = <70000>;
- + enable-active-high;
- + vin-supply = <&vmmc2>;
- + };
- +
- + /* HS USB Host PHY on PORT 1 */
- + hsusb2_phy: hsusb2_phy {
- + compatible = "usb-nop-xceiv";
- + reset-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; /* gpio_4 */
- + };
- +};
- +
- +&gpmc {
- + ranges = <0 0 0x00000000 0x1000000>; /* CS0: 16MB for NAND */
- +
- + nand@0,0 {
- + linux,mtd-name = "micron,mt29f4g16abbda3w";
- + reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
- + nand-bus-width = <16>;
- + ti,nand-ecc-opt = "bch8";
- + gpmc,sync-clk-ps = <0>;
- + gpmc,cs-on-ns = <0>;
- + gpmc,cs-rd-off-ns = <44>;
- + gpmc,cs-wr-off-ns = <44>;
- + gpmc,adv-on-ns = <6>;
- + gpmc,adv-rd-off-ns = <34>;
- + gpmc,adv-wr-off-ns = <44>;
- + gpmc,we-off-ns = <40>;
- + gpmc,oe-off-ns = <54>;
- + gpmc,access-ns = <64>;
- + gpmc,rd-cycle-ns = <82>;
- + gpmc,wr-cycle-ns = <82>;
- + gpmc,wr-access-ns = <40>;
- + gpmc,wr-data-mux-bus-ns = <0>;
- + gpmc,device-width = <2>;
- +
- + gpmc,page-burst-access-ns = <5>;
- + gpmc,cycle2cycle-delay-ns = <50>;
- +
- + #address-cells = <1>;
- + #size-cells = <1>;
- +
- + /* u-boot uses mtdparts=omap2-nand.0:512k(x-loader),1920k(u-boot),128k(u-boot-env),4m(kernel),-(fs) */
- +
- + x-loader@0 {
- + label = "x-loader";
- + reg = <0 0x80000>;
- + };
- +
- + bootloaders@80000 {
- + label = "u-boot";
- + reg = <0x80000 0x1e0000>;
- + };
- +
- + bootloaders_env@260000 {
- + label = "u-boot-env";
- + reg = <0x260000 0x20000>;
- + };
- +
- + kernel@280000 {
- + label = "kernel";
- + reg = <0x280000 0x400000>;
- + };
- +
- + filesystem@680000 {
- + label = "fs";
- + reg = <0x680000 0>; /* 0 = MTDPART_SIZ_FULL */
- + };
- + };
- +};
- +
- +&i2c1 {
- + clock-frequency = <2600000>;
- +
- + twl: twl@48 {
- + reg = <0x48>;
- + interrupts = <7>; /* SYS_NIRQ cascaded to intc */
- + interrupt-parent = <&intc>;
- + twl_audio: audio {
- + compatible = "ti,twl4030-audio";
- + codec {
- + };
- + };
- + };
- +};
- +
- +&i2c2 {
- + clock-frequency = <400000>;
- +};
- +
- +&i2c3 {
- + clock-frequency = <400000>;
- +};
- +
- +&mmc3 {
- + interrupts-extended = <&intc 94 &omap3_pmx_core2 0x46>;
- + pinctrl-0 = <&mmc3_pins>;
- + pinctrl-names = "default";
- + vmmc-supply = <&wl12xx_vmmc>;
- + non-removable;
- + bus-width = <4>;
- + cap-power-off-card;
- + #address-cells = <1>;
- + #size-cells = <0>;
- + wlcore: wlcore@2 {
- + compatible = "ti,wl1273";
- + reg = <2>;
- + interrupt-parent = <&gpio5>;
- + interrupts = <24 IRQ_TYPE_LEVEL_HIGH>; /* gpio 152 */
- + ref-clock-frequency = <26000000>;
- + };
- +};
- +
- +&usbhshost {
- + port2-mode = "ehci-phy";
- +};
- +
- +&usbhsehci {
- + phys = <0 &hsusb2_phy>;
- +};
- +
- +
- +&omap3_pmx_core {
- + pinctrl-names = "default";
- + pinctrl-0 = <&hsusb2_pins>;
- +
- + mmc3_pins: pinmux_mm3_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x2164, PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc2_dat4.sdmmc3_dat0 */
- + OMAP3_CORE1_IOPAD(0x2166, PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc2_dat5.sdmmc3_dat1 */
- + OMAP3_CORE1_IOPAD(0x2168, PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc2_dat6.sdmmc3_dat2 */
- + OMAP3_CORE1_IOPAD(0x216a, PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc2_dat6.sdmmc3_dat3 */
- + OMAP3_CORE1_IOPAD(0x2184, PIN_INPUT_PULLUP | MUX_MODE4) /* mcbsp4_clkx.gpio_152 */
- + OMAP3_CORE1_IOPAD(0x2a0c, PIN_OUTPUT | MUX_MODE4) /* sys_boot1.gpio_3 */
- + OMAP3_CORE1_IOPAD(0x21d0, PIN_INPUT_PULLUP | MUX_MODE3) /* mcspi1_cs1.sdmmc3_cmd */
- + OMAP3_CORE1_IOPAD(0x21d2, PIN_INPUT_PULLUP | MUX_MODE3) /* mcspi1_cs2.sdmmc_clk */
- + >;
- + };
- + mcbsp2_pins: pinmux_mcbsp2_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x213c, PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx */
- + OMAP3_CORE1_IOPAD(0x213e, PIN_INPUT | MUX_MODE0) /* mcbsp2_clkx */
- + OMAP3_CORE1_IOPAD(0x2140, PIN_INPUT | MUX_MODE0) /* mcbsp2_dr */
- + OMAP3_CORE1_IOPAD(0x2142, PIN_OUTPUT | MUX_MODE0) /* mcbsp2_dx */
- + >;
- + };
- + uart2_pins: pinmux_uart2_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x2174, PIN_INPUT | MUX_MODE0) /* uart2_cts.uart2_cts */
- + OMAP3_CORE1_IOPAD(0x2176, PIN_OUTPUT | MUX_MODE0) /* uart2_rts .uart2_rts*/
- + OMAP3_CORE1_IOPAD(0x2178, PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
- + OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
- + OMAP3_CORE1_IOPAD(0x2198, PIN_OUTPUT | MUX_MODE4) /* GPIO_162,BT_EN */
- + >;
- + };
- + mcspi1_pins: pinmux_mcspi1_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x21c8, PIN_INPUT | MUX_MODE0) /* mcspi1_clk.mcspi1_clk */
- + OMAP3_CORE1_IOPAD(0x21ca, PIN_OUTPUT | MUX_MODE0) /* mcspi1_simo.mcspi1_simo */
- + OMAP3_CORE1_IOPAD(0x21cc, PIN_INPUT_PULLUP | MUX_MODE0) /* mcspi1_somi.mcspi1_somi */
- + OMAP3_CORE1_IOPAD(0x21ce, PIN_OUTPUT | MUX_MODE0) /* mcspi1_cs0.mcspi1_cs0 */
- + >;
- + };
- +
- + hsusb2_pins: pinmux_hsusb2_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi1_cs3.hsusb2_data2 */
- + OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_clk.hsusb2_data7 */
- + OMAP3_CORE1_IOPAD(0x21d8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_simo.hsusb2_data4 */
- + OMAP3_CORE1_IOPAD(0x21da, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_somi.hsusb2_data5 */
- + OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs0.hsusb2_data6 */
- + OMAP3_CORE1_IOPAD(0x21de, PIN_INPUT_PULLDOWN | MUX_MODE3) /* mcspi2_cs1.hsusb2_data3 */
- + >;
- + };
- +
- + hsusb_otg_pins: pinmux_hsusb_otg_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x21a2, PIN_INPUT | MUX_MODE0) /* hsusb0_clk.hsusb0_clk */
- + OMAP3_CORE1_IOPAD(0x21a4, PIN_OUTPUT | MUX_MODE0) /* hsusb0_stp.hsusb0_stp */
- + OMAP3_CORE1_IOPAD(0x21a6, PIN_INPUT | MUX_MODE0) /* hsusb0_dir.hsusb0_dir */
- + OMAP3_CORE1_IOPAD(0x21a8, PIN_INPUT | MUX_MODE0) /* hsusb0_nxt.hsusb0_nxt */
- + OMAP3_CORE1_IOPAD(0x21aa, PIN_INPUT | MUX_MODE0) /* hsusb0_data0.hsusb0_data0 */
- + OMAP3_CORE1_IOPAD(0x21ac, PIN_INPUT | MUX_MODE0) /* hsusb0_data1.hsusb0_data1 */
- + OMAP3_CORE1_IOPAD(0x21ae, PIN_INPUT | MUX_MODE0) /* hsusb0_data2.hsusb0_data2 */
- + OMAP3_CORE1_IOPAD(0x21b0, PIN_INPUT | MUX_MODE0) /* hsusb0_data3.hsusb0_data3 */
- + OMAP3_CORE1_IOPAD(0x21b2, PIN_INPUT | MUX_MODE0) /* hsusb0_data4.hsusb0_data4 */
- + OMAP3_CORE1_IOPAD(0x21b4, PIN_INPUT | MUX_MODE0) /* hsusb0_data5.hsusb0_data5 */
- + OMAP3_CORE1_IOPAD(0x21b6, PIN_INPUT | MUX_MODE0) /* hsusb0_data6.hsusb0_data6 */
- + OMAP3_CORE1_IOPAD(0x21b8, PIN_INPUT | MUX_MODE0) /* hsusb0_data7.hsusb0_data7 */
- + >;
- + };
- +
- +
- +};
- +
- +&omap3_pmx_wkup {
- + pinctrl-names = "default";
- + pinctrl-0 = <&hsusb2_reset_pin>;
- + hsusb2_reset_pin: pinmux_hsusb1_reset_pin {
- + pinctrl-single,pins = <
- + OMAP3_WKUP_IOPAD(0x2a0e, PIN_OUTPUT | MUX_MODE4) /* sys_boot2.gpio_4 */
- + >;
- + };
- +};
- +
- +&omap3_pmx_core2 {
- + pinctrl-names = "default";
- + pinctrl-0 = <&hsusb2_2_pins>;
- + hsusb2_2_pins: pinmux_hsusb2_2_pins {
- + pinctrl-single,pins = <
- + OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3) /* etk_d10.hsusb2_clk */
- + OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3) /* etk_d11.hsusb2_stp */
- + OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d12.hsusb2_dir */
- + OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d13.hsusb2_nxt */
- + OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d14.hsusb2_data0 */
- + OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d15.hsusb2_data1 */
- + >;
- + };
- +};
- +
- +&uart2 {
- + interrupts-extended = <&intc 73 &omap3_pmx_core OMAP3_UART2_RX>;
- + pinctrl-names = "default";
- + pinctrl-0 = <&uart2_pins>;
- +};
- +
- +&mcspi1 {
- + pinctrl-names = "default";
- + pinctrl-0 = <&mcspi1_pins>;
- +};
- +
- +#include "twl4030.dtsi"
- +#include "twl4030_omap3.dtsi"
- +
- +&twl {
- + twl_power: power {
- + compatible = "ti,twl4030-power-idle-osc-off", "ti,twl4030-power-idle";
- + ti,use_poweroff;
- + };
- +};
- +
- +&twl_gpio {
- + ti,use-leds;
- +};
- diff --git a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts
- index 5b04300..140029f 100644
- --- a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts
- +++ b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit.dts
- @@ -11,7 +11,7 @@
- #include "omap-gpmc-smsc9221.dtsi"
- / {
- - model = "LogicPD Zoom DM3730 Torpedo Development Kit";
- + model = "LogicPD Zoom DM3730 Torpedo";
- compatible = "logicpd,dm3730-torpedo-devkit", "ti,omap3630", "ti,omap3";
- gpio_keys {
- @@ -23,31 +23,37 @@
- label = "sysboot2";
- gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; /* gpio2 */
- linux,code = <BTN_0>;
- - gpio-key,wakeup;
- + wakeup-source;
- };
- sysboot5 {
- label = "sysboot5";
- gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; /* gpio7 */
- linux,code = <BTN_1>;
- - gpio-key,wakeup;
- + wakeup-source;
- };
- gpio1 {
- label = "gpio1";
- gpios = <&gpio6 21 GPIO_ACTIVE_LOW>; /* gpio181 */
- linux,code = <BTN_2>;
- - gpio-key,wakeup;
- + wakeup-source;
- };
- gpio2 {
- label = "gpio2";
- gpios = <&gpio6 18 GPIO_ACTIVE_LOW>; /* gpio178 */
- linux,code = <BTN_3>;
- - gpio-key,wakeup;
- + wakeup-source;
- };
- };
- + sound {
- + compatible = "ti,omap-twl4030";
- + ti,model = "omap3logic";
- + ti,mcbsp = <&mcbsp2>;
- + };
- +
- leds {
- compatible = "gpio-leds";
- pinctrl-names = "default";
- @@ -65,6 +71,29 @@
- linux,default-trigger = "none";
- };
- };
- +
- + pwm10: dmtimer-pwm {
- + compatible = "ti,omap-dmtimer-pwm";
- + pinctrl-names = "default";
- + pinctrl-0 = <&pwm_pins>;
- + ti,timers = <&timer10>;
- + #pwm-cells = <3>;
- + };
- +
- +};
- +
- +&vaux1 {
- + regulator-min-microvolt = <3000000>;
- + regulator-max-microvolt = <3000000>;
- +};
- +
- +&vaux4 {
- + regulator-min-microvolt = <1800000>;
- + regulator-max-microvolt = <1800000>;
- +};
- +
- +&mcbsp2 {
- + status = "okay";
- };
- &charger {
- @@ -73,7 +102,8 @@
- };
- &gpmc {
- - ranges = <1 0 0x08000000 0x1000000>; /* CS1: 16MB for LAN9221 */
- + ranges = <0 0 0x30000000 0x1000000 /* CS0: 16MB for NAND */
- + 1 0 0x2c000000 0x1000000>; /* CS1: 16MB for LAN9221 */
- ethernet@gpmc {
- pinctrl-names = "default";
- @@ -84,6 +114,88 @@
- };
- };
- +&vpll2 {
- + regulator-always-on;
- +};
- +
- +&dss {
- + status = "ok";
- + vdds_dsi-supply = <&vpll2>;
- + vdda_video-supply = <&video_reg>;
- + pinctrl-names = "default";
- + pinctrl-0 = <&dss_dpi_pins1>;
- + port {
- + dpi_out: endpoint {
- + remote-endpoint = <&lcd_in>;
- + data-lines = <16>;
- + };
- + };
- +};
- +
- +/ {
- + aliases {
- + display0 = &lcd0;
- + };
- +
- + video_reg: video_reg {
- + pinctrl-names = "default";
- + pinctrl-0 = <&panel_pwr_pins>;
- + compatible = "regulator-fixed";
- + regulator-name = "lcd-supply";
- + regulator-min-microvolt = <3300000>;
- + regulator-max-microvolt = <3300000>;
- + gpio = <&gpio5 27 GPIO_ACTIVE_HIGH>; /* gpio155, lcd INI */
- + };
- +
- + lcd0: display {
- + compatible = "panel-dpi";
- + label = "snc";
- + status = "okay";
- + /* default-on; */
- + pinctrl-names = "default";
- +
- + port {
- + lcd_in: endpoint {
- + remote-endpoint = <&dpi_out>;
- + };
- + };
- +
- + panel-timing {
- + clock-frequency = <9000000>;
- + hactive = <480>;
- + vactive = <272>;
- + hfront-porch = <3>;
- + hback-porch = <2>;
- + hsync-len = <42>;
- + vback-porch = <3>;
- + vfront-porch = <2>;
- + vsync-len = <11>;
- + hsync-active = <1>;
- + vsync-active = <1>;
- + de-active = <1>;
- + pixelclk-active = <0>;
- + };
- + };
- +
- + backlight_reg: backlight_reg {
- + compatible = "regulator-fixed";
- + regulator-name = "dummy-supply";
- + regulator-min-microvolt = <3300000>;
- + regulator-max-microvolt = <3300000>;
- + };
- +
- + bl: backlight {
- + compatible = "pwm-backlight";
- + pinctrl-names = "default";
- + pinctrl-0 = <&backlight_pins>;
- + pwms = <&pwm10 0 5000000 0>;
- + brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
- + default-brightness-level = <7>;
- + enable-gpios = <&gpio5 26 GPIO_ACTIVE_HIGH>; /* gpio_154 */
- + power-supply = <&backlight_reg>;
- + };
- +};
- +
- &mmc1 {
- interrupts-extended = <&intc 83 &omap3_pmx_core 0x11a>;
- pinctrl-names = "default";
- @@ -102,6 +214,12 @@
- >;
- };
- + pwm_pins: pinmux_pwm_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x20B8, PIN_OUTPUT | PIN_OFF_OUTPUT_LOW | MUX_MODE3) /* gpmc_ncs5.gpt_10_pwm_evt */
- + >;
- + };
- +
- led_pins: pinmux_led_pins {
- pinctrl-single,pins = <
- OMAP3_CORE1_IOPAD(0x21d8, PIN_OUTPUT | MUX_MODE4) /* gpio_179 */
- @@ -119,6 +237,71 @@
- OMAP3_CORE1_IOPAD(0x214e, PIN_INPUT | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
- >;
- };
- +
- + tsc2004_pins: pinmux_tsc2004_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x2186, PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE4) /* mcbsp4_dr.gpio_153 */
- + >;
- + };
- +
- + backlight_pins: pinmux_backlight_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x2188, PIN_OUTPUT | PIN_OFF_OUTPUT_LOW | MUX_MODE4) /* mcbsp4_dx.gpio_154 */
- + >;
- + };
- +
- + isp_pins: pinmux_isp_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x210c, PIN_INPUT | MUX_MODE0) /* cam_hs.cam_hs */
- + OMAP3_CORE1_IOPAD(0x210e, PIN_INPUT | MUX_MODE0) /* cam_vs.cam_vs */
- + OMAP3_CORE1_IOPAD(0x2110, PIN_INPUT | MUX_MODE0) /* cam_xclka.cam_xclka */
- + OMAP3_CORE1_IOPAD(0x2112, PIN_INPUT | MUX_MODE0) /* cam_pclk.cam_pclk */
- +
- + OMAP3_CORE1_IOPAD(0x2114, PIN_INPUT | MUX_MODE0) /* cam_d0.cam_d0 */
- + OMAP3_CORE1_IOPAD(0x2116, PIN_INPUT | MUX_MODE0) /* cam_d1.cam_d1 */
- + OMAP3_CORE1_IOPAD(0x2118, PIN_INPUT | MUX_MODE0) /* cam_d2.cam_d2 */
- + OMAP3_CORE1_IOPAD(0x211c, PIN_INPUT | MUX_MODE0) /* cam_d3.cam_d3 */
- + OMAP3_CORE1_IOPAD(0x211e, PIN_INPUT | MUX_MODE0) /* cam_d4.cam_d4 */
- + OMAP3_CORE1_IOPAD(0x2120, PIN_INPUT | MUX_MODE0) /* cam_d5.cam_d5 */
- + OMAP3_CORE1_IOPAD(0x2122, PIN_INPUT | MUX_MODE0) /* cam_d6.cam_d6 */
- + OMAP3_CORE1_IOPAD(0x2124, PIN_INPUT | MUX_MODE0) /* cam_d7.cam_d7 */
- + >;
- + };
- +
- + panel_pwr_pins: pinmux_panel_pwr_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x218a, PIN_OUTPUT | PIN_OFF_OUTPUT_LOW | MUX_MODE4) /* mcbsp4_fs.gpio_155 */
- + >;
- + };
- +
- + dss_dpi_pins1: pinmux_dss_dpi_pins1 {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x20d4, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_pclk.dss_pclk */
- + OMAP3_CORE1_IOPAD(0x20d6, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_hsync.dss_hsync */
- + OMAP3_CORE1_IOPAD(0x20d8, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_vsync.dss_vsync */
- + OMAP3_CORE1_IOPAD(0x20da, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_acbias.dss_acbias */
- +
- + OMAP3_CORE1_IOPAD(0x20e8, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data6.dss_data6 */
- + OMAP3_CORE1_IOPAD(0x20ea, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data7.dss_data7 */
- + OMAP3_CORE1_IOPAD(0x20ec, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data8.dss_data8 */
- + OMAP3_CORE1_IOPAD(0x20ee, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data9.dss_data9 */
- + OMAP3_CORE1_IOPAD(0x20f0, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data10.dss_data10 */
- + OMAP3_CORE1_IOPAD(0x20f2, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data11.dss_data11 */
- + OMAP3_CORE1_IOPAD(0x20f4, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data12.dss_data12 */
- + OMAP3_CORE1_IOPAD(0x20f6, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data13.dss_data13 */
- + OMAP3_CORE1_IOPAD(0x20f8, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data14.dss_data14 */
- + OMAP3_CORE1_IOPAD(0x20fa, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data15.dss_data15 */
- + OMAP3_CORE1_IOPAD(0x20fc, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data16.dss_data16 */
- + OMAP3_CORE1_IOPAD(0x20fe, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE0) /* dss_data17.dss_data17 */
- +
- + OMAP3_CORE1_IOPAD(0x2100, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE3) /* dss_data18.dss_data0 */
- + OMAP3_CORE1_IOPAD(0x2102, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE3) /* dss_data19.dss_data1 */
- + OMAP3_CORE1_IOPAD(0x2104, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE3) /* dss_data20.dss_data2 */
- + OMAP3_CORE1_IOPAD(0x2106, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE3) /* dss_data21.dss_data3 */
- + OMAP3_CORE1_IOPAD(0x2108, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE3) /* dss_data22.dss_data4 */
- + OMAP3_CORE1_IOPAD(0x210a, PIN_OUTPUT_PULLDOWN | PIN_OFF_OUTPUT_LOW | MUX_MODE3) /* dss_data23.dss_data5 */
- + >;
- + };
- };
- &omap3_pmx_wkup {
- @@ -142,12 +325,84 @@
- };
- };
- +&i2c2 {
- + mt9p031@48 {
- + compatible = "aptina,mt9p031";
- + reg = <0x48>;
- + clocks = <&isp 0>;
- + vaa-supply = <&vaux4>;
- + vdd-supply = <&vaux4>;
- + vdd_io-supply = <&vaux4>;
- + port {
- + mt9p031_out: endpoint {
- + input-clock-frequency = <24000000>;
- + pixel-clock-frequency = <72000000>;
- + remote-endpoint = <&ccdc_ep>;
- + };
- + };
- + };
- +};
- +
- +&i2c3 {
- + touchscreen: tsc2004@48 {
- + compatible = "ti,tsc2004";
- + reg = <0x48>;
- + vio-supply = <&vaux1>;
- + pinctrl-names = "default";
- + pinctrl-0 = <&tsc2004_pins>;
- + interrupts-extended = <&gpio5 25 IRQ_TYPE_EDGE_RISING>; /* gpio 153 */
- +
- + touchscreen-fuzz-x = <4>;
- + touchscreen-fuzz-y = <7>;
- + touchscreen-fuzz-pressure = <2>;
- + touchscreen-size-x = <4096>;
- + touchscreen-size-y = <4096>;
- + touchscreen-max-pressure = <2048>;
- +
- + ti,x-plate-ohms = <280>;
- + ti,esd-recovery-timeout-ms = <8000>;
- + };
- +};
- +
- +&mcspi1 {
- + at25@0 {
- + compatible = "atmel,at25";
- + reg = <0>;
- + spi-max-frequency = <5000000>;
- + spi-cpha;
- + spi-cpol;
- +
- + pagesize = <64>;
- + size = <32768>;
- + address-width = <16>;
- + };
- +};
- +
- +&isp {
- + pinctrl-names = "default";
- + pinctrl-0 = <&isp_pins>;
- + ports {
- + port@0 {
- + reg = <0>;
- + ccdc_ep: endpoint {
- + remote-endpoint = <&mt9p031_out>;
- + bus-width = <8>;
- + hsync-active = <1>;
- + vsync-active = <1>;
- + pclk-sample = <0>;
- + };
- + };
- + };
- +};
- +
- &uart1 {
- interrupts-extended = <&intc 72 &omap3_pmx_core OMAP3_UART1_RX>;
- };
- /* Wired to the tps65950 on the SOM, only the USB connector is on the devkit */
- &usb_otg_hs {
- + pinctrl-names = "default";
- + pinctrl-0 = <&hsusb_otg_pins>;
- interface-type = <0>;
- usb-phy = <&usb2_phy>;
- phys = <&usb2_phy>;
- diff --git a/arch/arm/boot/dts/logicpd-torpedo-som.dtsi b/arch/arm/boot/dts/logicpd-torpedo-som.dtsi
- index 80f6c78..e05ade9 100644
- --- a/arch/arm/boot/dts/logicpd-torpedo-som.dtsi
- +++ b/arch/arm/boot/dts/logicpd-torpedo-som.dtsi
- @@ -21,7 +21,6 @@
- linux,default-trigger = "none";
- };
- };
- -
- wl12xx_vmmc: wl12xx_vmmc {
- compatible = "regulator-fixed";
- regulator-name = "vwl1271";
- @@ -38,8 +37,12 @@
- ranges = <0 0 0x00000000 0x1000000>; /* CS0: 16MB for NAND */
- nand@0,0 {
- - linux,mtd-name = "micron,mt29f4g16abbda3w";
- + compatible = "ti,omap2-nand";
- reg = <0 0 4>; /* CS0, offset 0, IO size 4 */
- + interrupt-parent = <&gpmc>;
- + interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */
- + <1 IRQ_TYPE_NONE>; /* termcount */
- + linux,mtd-name = "micron,mt29f4g16abbda3w";
- nand-bus-width = <16>;
- ti,nand-ecc-opt = "bch8";
- gpmc,sync-clk-ps = <0>;
- @@ -59,43 +62,34 @@
- gpmc,device-width = <2>;
- #address-cells = <1>;
- #size-cells = <1>;
- -
- - /* u-boot uses mtdparts=omap2-nand.0:512k(x-loader),1920k(u-boot),128k(u-boot-env),4m(kernel),-(fs) */
- -
- - x-loader@0 {
- - label = "x-loader";
- - reg = <0 0x80000>;
- - };
- -
- - bootloaders@80000 {
- - label = "u-boot";
- - reg = <0x80000 0x1e0000>;
- - };
- -
- - bootloaders_env@260000 {
- - label = "u-boot-env";
- - reg = <0x260000 0x20000>;
- - };
- -
- - kernel@280000 {
- - label = "kernel";
- - reg = <0x280000 0x400000>;
- - };
- -
- - filesystem@680000 {
- - label = "fs";
- - reg = <0x680000 0>; /* 0 = MTDPART_SIZ_FULL */
- - };
- };
- };
- &i2c1 {
- - clock-frequency = <2600000>;
- + clock-frequency = <400000>;
- twl: twl@48 {
- reg = <0x48>;
- interrupts = <7>; /* SYS_NIRQ cascaded to intc */
- interrupt-parent = <&intc>;
- + twl_audio: audio {
- + compatible = "ti,twl4030-audio";
- + codec {
- + };
- + };
- + };
- +};
- +
- +&i2c2 {
- + clock-frequency = <400000>;
- +};
- +
- +&i2c3 {
- + clock-frequency = <400000>;
- + at24@50 {
- + compatible = "at24,24c64";
- + readonly;
- + reg = <0x50>;
- };
- };
- @@ -137,6 +131,59 @@
- OMAP3_CORE1_IOPAD(0x218e, PIN_OUTPUT | MUX_MODE4) /* mcbsp1_fsr.gpio_157 */
- >;
- };
- + mcbsp2_pins: pinmux_mcbsp2_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x213c, PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx */
- + OMAP3_CORE1_IOPAD(0x213e, PIN_INPUT | MUX_MODE0) /* mcbsp2_clkx */
- + OMAP3_CORE1_IOPAD(0x2140, PIN_INPUT | MUX_MODE0) /* mcbsp2_dr */
- + OMAP3_CORE1_IOPAD(0x2142, PIN_OUTPUT | MUX_MODE0) /* mcbsp2_dx */
- + >;
- + };
- + uart2_pins: pinmux_uart2_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x2174, PIN_INPUT | MUX_MODE0) /* uart2_cts.uart2_cts */
- + OMAP3_CORE1_IOPAD(0x2176, PIN_OUTPUT | MUX_MODE0) /* uart2_rts .uart2_rts*/
- + OMAP3_CORE1_IOPAD(0x2178, PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
- + OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
- + OMAP3_CORE1_IOPAD(0x2198, PIN_OUTPUT | MUX_MODE4) /* GPIO_162,BT_EN */
- + >;
- + };
- + mcspi1_pins: pinmux_mcspi1_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x21c8, PIN_INPUT | MUX_MODE0) /* mcspi1_clk.mcspi1_clk */
- + OMAP3_CORE1_IOPAD(0x21ca, PIN_OUTPUT | MUX_MODE0) /* mcspi1_simo.mcspi1_simo */
- + OMAP3_CORE1_IOPAD(0x21cc, PIN_INPUT_PULLUP | MUX_MODE0) /* mcspi1_somi.mcspi1_somi */
- + OMAP3_CORE1_IOPAD(0x21ce, PIN_OUTPUT | MUX_MODE0) /* mcspi1_cs0.mcspi1_cs0 */
- + >;
- + };
- + hsusb_otg_pins: pinmux_hsusb_otg_pins {
- + pinctrl-single,pins = <
- + OMAP3_CORE1_IOPAD(0x21a2, PIN_INPUT | MUX_MODE0) /* hsusb0_clk.hsusb0_clk */
- + OMAP3_CORE1_IOPAD(0x21a4, PIN_OUTPUT | MUX_MODE0) /* hsusb0_stp.hsusb0_stp */
- + OMAP3_CORE1_IOPAD(0x21a6, PIN_INPUT | MUX_MODE0) /* hsusb0_dir.hsusb0_dir */
- + OMAP3_CORE1_IOPAD(0x21a8, PIN_INPUT | MUX_MODE0) /* hsusb0_nxt.hsusb0_nxt */
- +
- + OMAP3_CORE1_IOPAD(0x21aa, PIN_INPUT | MUX_MODE0) /* hsusb0_data0.hsusb0_data0 */
- + OMAP3_CORE1_IOPAD(0x21ac, PIN_INPUT | MUX_MODE0) /* hsusb0_data1.hsusb0_data1 */
- + OMAP3_CORE1_IOPAD(0x21ae, PIN_INPUT | MUX_MODE0) /* hsusb0_data2.hsusb0_data2 */
- + OMAP3_CORE1_IOPAD(0x21b0, PIN_INPUT | MUX_MODE0) /* hsusb0_data3.hsusb0_data3 */
- + OMAP3_CORE1_IOPAD(0x21b2, PIN_INPUT | MUX_MODE0) /* hsusb0_data4.hsusb0_data4 */
- + OMAP3_CORE1_IOPAD(0x21b4, PIN_INPUT | MUX_MODE0) /* hsusb0_data5.hsusb0_data5 */
- + OMAP3_CORE1_IOPAD(0x21b6, PIN_INPUT | MUX_MODE0) /* hsusb0_data6.hsusb0_data6 */
- + OMAP3_CORE1_IOPAD(0x21b8, PIN_INPUT | MUX_MODE0) /* hsusb0_data7.hsusb0_data7 */
- + >;
- + };
- +};
- +
- +&uart2 {
- + interrupts-extended = <&intc 73 &omap3_pmx_core OMAP3_UART2_RX>;
- + pinctrl-names = "default";
- + pinctrl-0 = <&uart2_pins>;
- +};
- +
- +&mcspi1 {
- + pinctrl-names = "default";
- + pinctrl-0 = <&mcspi1_pins>;
- };
- &omap3_pmx_core2 {
- @@ -148,9 +195,17 @@
- };
- };
- +&ssi {
- + status = "disabled";
- +};
- +
- #include "twl4030.dtsi"
- #include "twl4030_omap3.dtsi"
- +&charger {
- + status = "disabled";
- +};
- +
- &twl {
- twl_power: power {
- compatible = "ti,twl4030-power-idle-osc-off", "ti,twl4030-power-idle";
- @@ -161,3 +216,7 @@
- &twl_gpio {
- ti,use-leds;
- };
- +
- +&twl_keypad {
- + status = "disabled";
- +};
- diff --git a/arch/arm/configs/omap3logic_defconfig b/arch/arm/configs/omap3logic_defconfig
- new file mode 100644
- index 0000000..44637eb
- --- /dev/null
- +++ b/arch/arm/configs/omap3logic_defconfig
- @@ -0,0 +1,456 @@
- +CONFIG_KERNEL_XZ=y
- +CONFIG_SYSVIPC=y
- +CONFIG_POSIX_MQUEUE=y
- +CONFIG_FHANDLE=y
- +CONFIG_AUDIT=y
- +CONFIG_NO_HZ=y
- +CONFIG_HIGH_RES_TIMERS=y
- +CONFIG_BSD_PROCESS_ACCT=y
- +CONFIG_IKCONFIG=y
- +CONFIG_IKCONFIG_PROC=y
- +CONFIG_LOG_BUF_SHIFT=16
- +CONFIG_CGROUPS=y
- +CONFIG_CGROUP_FREEZER=y
- +CONFIG_CGROUP_DEVICE=y
- +CONFIG_CPUSETS=y
- +CONFIG_CGROUP_CPUACCT=y
- +CONFIG_MEMCG=y
- +CONFIG_MEMCG_SWAP=y
- +CONFIG_MEMCG_KMEM=y
- +CONFIG_CGROUP_PERF=y
- +CONFIG_CGROUP_SCHED=y
- +CONFIG_CFS_BANDWIDTH=y
- +CONFIG_RT_GROUP_SCHED=y
- +CONFIG_BLK_CGROUP=y
- +CONFIG_BLK_DEV_INITRD=y
- +CONFIG_SLAB=y
- +CONFIG_PROFILING=y
- +CONFIG_OPROFILE=y
- +CONFIG_KPROBES=y
- +CONFIG_MODULES=y
- +CONFIG_MODULE_FORCE_LOAD=y
- +CONFIG_MODULE_UNLOAD=y
- +CONFIG_MODULE_FORCE_UNLOAD=y
- +CONFIG_MODVERSIONS=y
- +CONFIG_MODULE_SRCVERSION_ALL=y
- +# CONFIG_BLK_DEV_BSG is not set
- +CONFIG_PARTITION_ADVANCED=y
- +CONFIG_ARCH_MULTI_V6=y
- +CONFIG_POWER_AVS_OMAP=y
- +CONFIG_POWER_AVS_OMAP_CLASS3=y
- +CONFIG_OMAP_RESET_CLOCKS=y
- +CONFIG_OMAP_MUX_DEBUG=y
- +CONFIG_ARCH_OMAP2=y
- +CONFIG_ARCH_OMAP3=y
- +CONFIG_ARM_THUMBEE=y
- +CONFIG_ARM_ERRATA_411920=y
- +CONFIG_ARM_ERRATA_430973=y
- +CONFIG_SMP=y
- +CONFIG_NR_CPUS=2
- +CONFIG_CMA=y
- +CONFIG_SECCOMP=y
- +CONFIG_ZBOOT_ROM_TEXT=0x0
- +CONFIG_ZBOOT_ROM_BSS=0x0
- +CONFIG_ARM_APPENDED_DTB=y
- +CONFIG_ARM_ATAG_DTB_COMPAT=y
- +CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200"
- +CONFIG_KEXEC=y
- +CONFIG_CPU_FREQ=y
- +CONFIG_CPU_FREQ_STAT_DETAILS=y
- +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
- +CONFIG_CPU_FREQ_GOV_POWERSAVE=y
- +CONFIG_CPU_FREQ_GOV_USERSPACE=y
- +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
- +CONFIG_CPUFREQ_DT=m
- +# CONFIG_ARM_OMAP2PLUS_CPUFREQ is not set
- +CONFIG_CPU_IDLE=y
- +CONFIG_BINFMT_MISC=y
- +CONFIG_PM_DEBUG=y
- +CONFIG_NET=y
- +CONFIG_PACKET=y
- +CONFIG_UNIX=y
- +CONFIG_XFRM_USER=y
- +CONFIG_NET_KEY=y
- +CONFIG_NET_KEY_MIGRATE=y
- +CONFIG_INET=y
- +CONFIG_IP_MULTICAST=y
- +CONFIG_IP_PNP=y
- +CONFIG_IP_PNP_DHCP=y
- +CONFIG_IP_PNP_BOOTP=y
- +CONFIG_IP_PNP_RARP=y
- +# CONFIG_INET_LRO is not set
- +CONFIG_NETFILTER=y
- +CONFIG_BRIDGE=y
- +CONFIG_PHONET=m
- +CONFIG_CAN=m
- +CONFIG_CAN_C_CAN=m
- +CONFIG_CAN_C_CAN_PLATFORM=m
- +CONFIG_BT=m
- +CONFIG_BT_RFCOMM=m
- +CONFIG_BT_RFCOMM_TTY=y
- +CONFIG_BT_BNEP=m
- +CONFIG_BT_BNEP_MC_FILTER=y
- +CONFIG_BT_BNEP_PROTO_FILTER=y
- +CONFIG_BT_HIDP=m
- +CONFIG_BT_HCIBTUSB=m
- +CONFIG_BT_HCIBTSDIO=m
- +CONFIG_BT_HCIUART=m
- +CONFIG_BT_HCIUART_BCSP=y
- +CONFIG_BT_HCIUART_LL=y
- +CONFIG_BT_HCIUART_3WIRE=y
- +CONFIG_BT_HCIBCM203X=m
- +CONFIG_BT_HCIBPA10X=m
- +CONFIG_BT_HCIBFUSB=m
- +CONFIG_BT_HCIVHCI=m
- +CONFIG_BT_MRVL=m
- +CONFIG_BT_MRVL_SDIO=m
- +CONFIG_AF_RXRPC=m
- +CONFIG_RXKAD=m
- +CONFIG_CFG80211=m
- +CONFIG_MAC80211=m
- +CONFIG_DEVTMPFS=y
- +CONFIG_DEVTMPFS_MOUNT=y
- +CONFIG_DMA_CMA=y
- +CONFIG_OMAP_OCP2SCP=y
- +CONFIG_CONNECTOR=m
- +CONFIG_MTD=y
- +CONFIG_MTD_CMDLINE_PARTS=y
- +CONFIG_MTD_BLOCK=y
- +CONFIG_MTD_OOPS=y
- +CONFIG_MTD_CFI=y
- +CONFIG_MTD_CFI_INTELEXT=y
- +CONFIG_MTD_PHYSMAP=y
- +CONFIG_MTD_PHYSMAP_OF=y
- +CONFIG_MTD_M25P80=m
- +CONFIG_MTD_NAND=y
- +CONFIG_MTD_NAND_ECC_BCH=y
- +CONFIG_MTD_NAND_OMAP2=y
- +CONFIG_MTD_NAND_OMAP_BCH=y
- +CONFIG_MTD_ONENAND=y
- +CONFIG_MTD_ONENAND_VERIFY_WRITE=y
- +CONFIG_MTD_ONENAND_OMAP2=y
- +CONFIG_MTD_SPI_NOR=m
- +CONFIG_MTD_UBI=y
- +CONFIG_BLK_DEV_LOOP=y
- +CONFIG_BLK_DEV_RAM=y
- +CONFIG_BLK_DEV_RAM_SIZE=16384
- +CONFIG_SENSORS_TSL2550=m
- +CONFIG_BMP085_I2C=m
- +CONFIG_SRAM=y
- +CONFIG_EEPROM_AT24=y
- +CONFIG_LPD_EEPROM=m
- +CONFIG_SENSORS_LIS3_I2C=m
- +CONFIG_BLK_DEV_SD=y
- +CONFIG_SCSI_SCAN_ASYNC=y
- +CONFIG_ATA=y
- +CONFIG_SATA_AHCI_PLATFORM=y
- +CONFIG_NETDEVICES=y
- +# CONFIG_NET_VENDOR_ARC is not set
- +# CONFIG_NET_CADENCE is not set
- +# CONFIG_NET_VENDOR_BROADCOM is not set
- +# CONFIG_NET_VENDOR_CIRRUS is not set
- +CONFIG_DM9000=y
- +# CONFIG_NET_VENDOR_FARADAY is not set
- +# CONFIG_NET_VENDOR_HISILICON is not set
- +# CONFIG_NET_VENDOR_INTEL is not set
- +# CONFIG_NET_VENDOR_MARVELL is not set
- +CONFIG_KS8851=y
- +CONFIG_KS8851_MLL=y
- +# CONFIG_NET_VENDOR_MICROCHIP is not set
- +# CONFIG_NET_VENDOR_NATSEMI is not set
- +# CONFIG_NET_VENDOR_QUALCOMM is not set
- +# CONFIG_NET_VENDOR_SAMSUNG is not set
- +# CONFIG_NET_VENDOR_SEEQ is not set
- +CONFIG_SMC91X=y
- +CONFIG_SMSC911X=y
- +# CONFIG_NET_VENDOR_STMICRO is not set
- +CONFIG_TI_DAVINCI_EMAC=y
- +CONFIG_TI_CPSW=y
- +CONFIG_TI_CPTS=y
- +# CONFIG_NET_VENDOR_VIA is not set
- +# CONFIG_NET_VENDOR_WIZNET is not set
- +CONFIG_AT803X_PHY=y
- +CONFIG_SMSC_PHY=y
- +CONFIG_USB_USBNET=m
- +CONFIG_USB_NET_SMSC95XX=m
- +CONFIG_USB_ALI_M5632=y
- +CONFIG_USB_AN2720=y
- +CONFIG_USB_EPSON2888=y
- +CONFIG_USB_KC2190=y
- +CONFIG_USB_CDC_PHONET=m
- +CONFIG_LIBERTAS=m
- +CONFIG_LIBERTAS_USB=m
- +CONFIG_LIBERTAS_SDIO=m
- +CONFIG_LIBERTAS_DEBUG=y
- +CONFIG_WL_TI=y
- +CONFIG_WL12XX=m
- +CONFIG_WL18XX=m
- +CONFIG_WLCORE_SPI=m
- +CONFIG_WLCORE_SDIO=m
- +CONFIG_MWIFIEX=m
- +CONFIG_MWIFIEX_SDIO=m
- +CONFIG_MWIFIEX_USB=m
- +CONFIG_INPUT_JOYDEV=m
- +CONFIG_INPUT_EVDEV=m
- +CONFIG_KEYBOARD_ATKBD=m
- +CONFIG_KEYBOARD_GPIO=m
- +CONFIG_KEYBOARD_MATRIX=m
- +# CONFIG_INPUT_MOUSE is not set
- +CONFIG_INPUT_TOUCHSCREEN=y
- +CONFIG_TOUCHSCREEN_ADS7846=m
- +CONFIG_TOUCHSCREEN_EDT_FT5X06=m
- +CONFIG_TOUCHSCREEN_TI_AM335X_TSC=m
- +CONFIG_TOUCHSCREEN_PIXCIR=m
- +CONFIG_TOUCHSCREEN_TSC2004=m
- +CONFIG_TOUCHSCREEN_TSC2005=m
- +CONFIG_TOUCHSCREEN_TSC2007=m
- +CONFIG_INPUT_MISC=y
- +CONFIG_INPUT_TPS65218_PWRBUTTON=m
- +CONFIG_INPUT_TWL4030_PWRBUTTON=m
- +CONFIG_INPUT_PALMAS_PWRBUTTON=m
- +CONFIG_SERIO=m
- +# CONFIG_LEGACY_PTYS is not set
- +CONFIG_SERIAL_8250=y
- +CONFIG_SERIAL_8250_CONSOLE=y
- +CONFIG_SERIAL_8250_NR_UARTS=32
- +CONFIG_SERIAL_8250_EXTENDED=y
- +CONFIG_SERIAL_8250_MANY_PORTS=y
- +CONFIG_SERIAL_8250_SHARE_IRQ=y
- +CONFIG_SERIAL_8250_DETECT_IRQ=y
- +CONFIG_SERIAL_8250_RSA=y
- +CONFIG_SERIAL_OF_PLATFORM=y
- +CONFIG_SERIAL_OMAP=y
- +CONFIG_SERIAL_OMAP_CONSOLE=y
- +CONFIG_I2C_CHARDEV=y
- +CONFIG_SPI=y
- +CONFIG_SPI_OMAP24XX=y
- +CONFIG_SPI_TI_QSPI=m
- +CONFIG_PINCTRL_SINGLE=y
- +CONFIG_GPIO_SYSFS=y
- +CONFIG_GPIO_PCA953X=m
- +CONFIG_GPIO_PCF857X=y
- +CONFIG_GPIO_PALMAS=y
- +CONFIG_GPIO_TWL4030=y
- +CONFIG_W1=m
- +CONFIG_HDQ_MASTER_OMAP=m
- +CONFIG_W1_SLAVE_BQ27000=m
- +CONFIG_PDA_POWER=m
- +CONFIG_BATTERY_BQ27XXX=m
- +CONFIG_CHARGER_ISP1704=m
- +CONFIG_CHARGER_TWL4030=m
- +CONFIG_CHARGER_BQ2415X=m
- +CONFIG_CHARGER_BQ24190=m
- +CONFIG_CHARGER_BQ24735=m
- +CONFIG_POWER_RESET=y
- +CONFIG_POWER_AVS=y
- +CONFIG_HWMON=m
- +CONFIG_SENSORS_GPIO_FAN=m
- +CONFIG_SENSORS_LM75=m
- +CONFIG_SENSORS_TMP102=m
- +CONFIG_THERMAL=m
- +CONFIG_THERMAL_GOV_FAIR_SHARE=y
- +CONFIG_THERMAL_GOV_USER_SPACE=y
- +CONFIG_CPU_THERMAL=y
- +CONFIG_TI_SOC_THERMAL=m
- +CONFIG_TI_THERMAL=y
- +CONFIG_WATCHDOG=y
- +CONFIG_OMAP_WATCHDOG=m
- +CONFIG_TWL4030_WATCHDOG=m
- +CONFIG_MFD_TI_AM335X_TSCADC=m
- +CONFIG_MFD_PALMAS=y
- +CONFIG_MFD_TPS65217=y
- +CONFIG_MFD_TPS65218=y
- +CONFIG_MFD_TPS65910=y
- +CONFIG_TWL6040_CORE=y
- +CONFIG_REGULATOR_PALMAS=y
- +CONFIG_REGULATOR_PBIAS=y
- +CONFIG_REGULATOR_TI_ABB=y
- +CONFIG_REGULATOR_TPS62360=m
- +CONFIG_REGULATOR_TPS65023=y
- +CONFIG_REGULATOR_TPS6507X=y
- +CONFIG_REGULATOR_TPS65217=y
- +CONFIG_REGULATOR_TPS65218=y
- +CONFIG_REGULATOR_TPS65910=y
- +CONFIG_REGULATOR_TWL4030=y
- +CONFIG_FB=y
- +CONFIG_FIRMWARE_EDID=y
- +CONFIG_FB_MODE_HELPERS=y
- +CONFIG_FB_TILEBLITTING=y
- +CONFIG_OMAP2_DSS=y
- +CONFIG_OMAP2_DSS_SDI=y
- +CONFIG_OMAP2_DSS_DSI=y
- +CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK=4
- +CONFIG_FB_OMAP2=y
- +CONFIG_DISPLAY_ENCODER_TFP410=m
- +CONFIG_DISPLAY_ENCODER_TPD12S015=m
- +CONFIG_DISPLAY_CONNECTOR_DVI=m
- +CONFIG_DISPLAY_CONNECTOR_HDMI=m
- +CONFIG_DISPLAY_CONNECTOR_ANALOG_TV=m
- +CONFIG_DISPLAY_PANEL_DPI=y
- +CONFIG_DISPLAY_PANEL_DSI_CM=m
- +CONFIG_DISPLAY_PANEL_SONY_ACX565AKM=m
- +CONFIG_DISPLAY_PANEL_LGPHILIPS_LB035Q02=m
- +CONFIG_DISPLAY_PANEL_SHARP_LS037V7DW01=m
- +CONFIG_DISPLAY_PANEL_TPO_TD028TTEC1=m
- +CONFIG_DISPLAY_PANEL_TPO_TD043MTEA1=m
- +CONFIG_DISPLAY_PANEL_NEC_NL8048HL11=m
- +CONFIG_BACKLIGHT_LCD_SUPPORT=y
- +CONFIG_LCD_CLASS_DEVICE=y
- +CONFIG_LCD_PLATFORM=y
- +CONFIG_BACKLIGHT_CLASS_DEVICE=y
- +CONFIG_BACKLIGHT_GENERIC=m
- +CONFIG_BACKLIGHT_PWM=m
- +CONFIG_BACKLIGHT_PANDORA=m
- +CONFIG_BACKLIGHT_GPIO=m
- +CONFIG_FRAMEBUFFER_CONSOLE=y
- +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
- +CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
- +CONFIG_LOGO=y
- +CONFIG_SOUND=m
- +CONFIG_SND=m
- +CONFIG_SND_MIXER_OSS=m
- +CONFIG_SND_PCM_OSS=m
- +CONFIG_SND_VERBOSE_PRINTK=y
- +CONFIG_SND_DEBUG=y
- +CONFIG_SND_USB_AUDIO=m
- +CONFIG_SND_SOC=m
- +CONFIG_SND_DAVINCI_SOC_MCASP=m
- +CONFIG_SND_OMAP_SOC=m
- +CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m
- +CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
- +CONFIG_SND_SOC_TLV320AIC3X=m
- +CONFIG_SND_SIMPLE_CARD=m
- +CONFIG_HID_GENERIC=m
- +# CONFIG_HID_A4TECH is not set
- +# CONFIG_HID_APPLE is not set
- +# CONFIG_HID_BELKIN is not set
- +# CONFIG_HID_CHERRY is not set
- +# CONFIG_HID_CHICONY is not set
- +# CONFIG_HID_CYPRESS is not set
- +# CONFIG_HID_EZKEY is not set
- +# CONFIG_HID_KENSINGTON is not set
- +# CONFIG_HID_LOGITECH is not set
- +# CONFIG_HID_MICROSOFT is not set
- +# CONFIG_HID_MONTEREY is not set
- +CONFIG_USB_HIDDEV=y
- +CONFIG_USB=y
- +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
- +CONFIG_USB_MON=m
- +CONFIG_USB_EHCI_HCD=y
- +CONFIG_USB_OHCI_HCD=m
- +CONFIG_USB_WDM=m
- +CONFIG_USB_STORAGE=m
- +CONFIG_USB_MUSB_HDRC=y
- +CONFIG_USB_MUSB_OMAP2PLUS=y
- +CONFIG_USB_MUSB_AM35X=m
- +CONFIG_USB_MUSB_DSPS=m
- +CONFIG_USB_INVENTRA_DMA=y
- +CONFIG_USB_TI_CPPI41_DMA=y
- +CONFIG_USB_DWC3=m
- +CONFIG_USB_TEST=m
- +CONFIG_AM335X_PHY_USB=y
- +CONFIG_USB_GADGET=y
- +CONFIG_USB_GADGET_DEBUG_FILES=y
- +CONFIG_USB_GADGET_DEBUG_FS=y
- +CONFIG_USB_CONFIGFS=m
- +CONFIG_USB_CONFIGFS_SERIAL=y
- +CONFIG_USB_CONFIGFS_ACM=y
- +CONFIG_USB_CONFIGFS_OBEX=y
- +CONFIG_USB_CONFIGFS_NCM=y
- +CONFIG_USB_CONFIGFS_ECM=y
- +CONFIG_USB_CONFIGFS_ECM_SUBSET=y
- +CONFIG_USB_CONFIGFS_RNDIS=y
- +CONFIG_USB_CONFIGFS_EEM=y
- +CONFIG_USB_CONFIGFS_PHONET=y
- +CONFIG_USB_CONFIGFS_MASS_STORAGE=y
- +CONFIG_USB_CONFIGFS_F_LB_SS=y
- +CONFIG_USB_CONFIGFS_F_FS=y
- +CONFIG_USB_CONFIGFS_F_UAC1=y
- +CONFIG_USB_CONFIGFS_F_UAC2=y
- +CONFIG_USB_CONFIGFS_F_MIDI=y
- +CONFIG_USB_CONFIGFS_F_HID=y
- +CONFIG_USB_ZERO=m
- +CONFIG_USB_ETH=m
- +CONFIG_USB_MASS_STORAGE=m
- +CONFIG_USB_G_NOKIA=m
- +CONFIG_MMC=y
- +CONFIG_SDIO_UART=y
- +CONFIG_MMC_OMAP=y
- +CONFIG_MMC_OMAP_HS=y
- +CONFIG_NEW_LEDS=y
- +CONFIG_LEDS_CLASS=m
- +CONFIG_LEDS_GPIO=m
- +CONFIG_LEDS_PWM=m
- +CONFIG_LEDS_TRIGGERS=y
- +CONFIG_LEDS_TRIGGER_TIMER=m
- +CONFIG_LEDS_TRIGGER_ONESHOT=m
- +CONFIG_LEDS_TRIGGER_HEARTBEAT=m
- +CONFIG_LEDS_TRIGGER_BACKLIGHT=m
- +CONFIG_LEDS_TRIGGER_CPU=y
- +CONFIG_LEDS_TRIGGER_GPIO=m
- +CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
- +CONFIG_RTC_CLASS=y
- +CONFIG_RTC_DRV_DS1307=m
- +CONFIG_RTC_DRV_PALMAS=m
- +CONFIG_RTC_DRV_TWL92330=y
- +CONFIG_RTC_DRV_TWL4030=y
- +CONFIG_RTC_DRV_OMAP=m
- +CONFIG_DMADEVICES=y
- +CONFIG_DMA_OMAP=y
- +CONFIG_TI_EDMA=y
- +# CONFIG_IOMMU_SUPPORT is not set
- +CONFIG_EXTCON=m
- +CONFIG_EXTCON_PALMAS=m
- +CONFIG_EXTCON_USB_GPIO=m
- +CONFIG_TI_EMIF=m
- +CONFIG_OMAP_GPMC_DEBUG=y
- +CONFIG_IIO=m
- +CONFIG_TI_AM335X_ADC=m
- +CONFIG_PWM=y
- +CONFIG_PWM_OMAP_DMTIMER=m
- +CONFIG_PWM_TIECAP=m
- +CONFIG_PWM_TIEHRPWM=m
- +CONFIG_PWM_TWL=m
- +CONFIG_PWM_TWL_LED=m
- +CONFIG_PHY_DM816X_USB=m
- +CONFIG_OMAP_USB2=m
- +CONFIG_TI_PIPE3=y
- +CONFIG_TWL4030_USB=y
- +CONFIG_EXT2_FS=y
- +CONFIG_EXT3_FS=y
- +CONFIG_FANOTIFY=y
- +CONFIG_QUOTA=y
- +CONFIG_QFMT_V2=y
- +CONFIG_AUTOFS4_FS=m
- +CONFIG_MSDOS_FS=y
- +CONFIG_VFAT_FS=y
- +CONFIG_TMPFS=y
- +CONFIG_TMPFS_POSIX_ACL=y
- +CONFIG_CONFIGFS_FS=y
- +CONFIG_JFFS2_FS=y
- +CONFIG_JFFS2_SUMMARY=y
- +CONFIG_JFFS2_FS_XATTR=y
- +CONFIG_JFFS2_COMPRESSION_OPTIONS=y
- +CONFIG_JFFS2_LZO=y
- +CONFIG_JFFS2_RUBIN=y
- +CONFIG_UBIFS_FS=y
- +CONFIG_CRAMFS=y
- +CONFIG_NFS_FS=y
- +CONFIG_NFS_V3_ACL=y
- +CONFIG_NFS_V4=y
- +CONFIG_ROOT_NFS=y
- +CONFIG_NLS_CODEPAGE_437=y
- +CONFIG_NLS_ISO8859_1=y
- +CONFIG_PRINTK_TIME=y
- +CONFIG_MAGIC_SYSRQ=y
- +CONFIG_FTRACE=y
- +CONFIG_SECURITY=y
- +CONFIG_CRYPTO_MICHAEL_MIC=y
- +CONFIG_CRC_CCITT=y
- +CONFIG_CRC_T10DIF=y
- +CONFIG_CRC_ITU_T=y
- +CONFIG_CRC7=y
- +CONFIG_LIBCRC32C=y
- +CONFIG_FONTS=y
- +CONFIG_FONT_8x8=y
- +CONFIG_FONT_8x16=y
- diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
- index 5814477..2a91e7f 100644
- --- a/arch/arm/mach-omap2/pdata-quirks.c
- +++ b/arch/arm/mach-omap2/pdata-quirks.c
- @@ -23,6 +23,8 @@
- #include <linux/platform_data/pinctrl-single.h>
- #include <linux/platform_data/iommu-omap.h>
- #include <linux/platform_data/wkup_m3.h>
- +#include <linux/platform_data/pwm_omap_dmtimer.h>
- +#include <plat/dmtimer.h>
- #include "common.h"
- #include "common-board-devices.h"
- @@ -33,6 +35,14 @@
- #include "soc.h"
- #include "hsmmc.h"
- +#if defined (CONFIG_USB_C67X00_HCD) || defined (CONFIG_USB_C67X00_HCD_MODULE)
- +#include <linux/usb/c67x00.h>
- +#include <linux/omap-gpmc.h>
- +#include "mux.h"
- +#include "mux34xx.h"
- +#endif
- +
- +
- struct pdata_init {
- const char *compatible;
- void (*fn)(void);
- @@ -271,6 +281,15 @@ static void __init nokia_n900_legacy_init(void)
- }
- }
- +/* add support for older drivers for som-lv board */
- +
- +
- +
- +static void __init omap3_som_lv_init(void)
- +{
- + omap3_gpio126_127_129();
- +}
- +
- static void __init omap3_tao3530_legacy_init(void)
- {
- hsmmc2_internal_input_clk();
- @@ -427,6 +446,24 @@ void omap_auxdata_legacy_init(struct device *dev)
- dev->platform_data = &twl_gpio_auxdata;
- }
- +/* Dual mode timer PWM callbacks platdata */
- +#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
- +struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
- + .request_by_node = omap_dm_timer_request_by_node,
- + .free = omap_dm_timer_free,
- + .enable = omap_dm_timer_enable,
- + .disable = omap_dm_timer_disable,
- + .get_fclk = omap_dm_timer_get_fclk,
- + .start = omap_dm_timer_start,
- + .stop = omap_dm_timer_stop,
- + .set_load = omap_dm_timer_set_load,
- + .set_match = omap_dm_timer_set_match,
- + .set_pwm = omap_dm_timer_set_pwm,
- + .set_prescaler = omap_dm_timer_set_prescaler,
- + .write_counter = omap_dm_timer_write_counter,
- +};
- +#endif
- +
- /*
- * Few boards still need auxdata populated before we populate
- * the dev entries in of_platform_populate().
- @@ -480,6 +517,9 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
- OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3",
- &wkup_m3_data),
- #endif
- +#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
- + OF_DEV_AUXDATA("ti,omap-dmtimer-pwm", 0, NULL, &pwm_dmtimer_pdata),
- +#endif
- #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
- OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu",
- &omap4_iommu_pdata),
- @@ -504,6 +544,7 @@ static struct pdata_init pdata_quirks[] __initdata = {
- { "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
- { "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
- { "logicpd,dm3730-torpedo-devkit", omap3_gpio126_127_129, },
- + { "logicpd,dm3730-som-lv-devkit", omap3_som_lv_init, },
- { "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
- { "ti,am3517-evm", am3517_evm_legacy_init, },
- { "technexion,omap3-tao3530", omap3_tao3530_legacy_init, },
- diff --git a/drivers/misc/eeprom/Kconfig b/drivers/misc/eeprom/Kconfig
- index 04f2e1f..2cb0f9a 100644
- --- a/drivers/misc/eeprom/Kconfig
- +++ b/drivers/misc/eeprom/Kconfig
- @@ -27,6 +27,15 @@ config EEPROM_AT24
- This driver can also be built as a module. If so, the module
- will be called at24.
- +config LPD_EEPROM
- + tristate "Logic PD MFG EEPROM"
- + depends on EEPROM_AT24
- + help
- + Enable this driver to extract MFG EEPROM information like:
- + dr_timings part_number version_code
- + lan_macaddr serial_number wifi_config_data
- + model_name speed_mhz wifi_macaddr
- +
- config EEPROM_AT25
- tristate "SPI EEPROMs from most vendors"
- depends on SPI && SYSFS
- diff --git a/drivers/misc/eeprom/Makefile b/drivers/misc/eeprom/Makefile
- index fc1e81d..d5908bd6 100644
- --- a/drivers/misc/eeprom/Makefile
- +++ b/drivers/misc/eeprom/Makefile
- @@ -1,4 +1,5 @@
- obj-$(CONFIG_EEPROM_AT24) += at24.o
- +obj-$(CONFIG_LPD_EEPROM) += logicpd-new-productid.o
- obj-$(CONFIG_EEPROM_AT25) += at25.o
- obj-$(CONFIG_EEPROM_LEGACY) += eeprom.o
- obj-$(CONFIG_EEPROM_MAX6875) += max6875.o
- diff --git a/drivers/misc/eeprom/logicpd-new-productid.c b/drivers/misc/eeprom/logicpd-new-productid.c
- new file mode 100644
- index 0000000..4f14c59
- --- /dev/null
- +++ b/drivers/misc/eeprom/logicpd-new-productid.c
- @@ -0,0 +1,1482 @@
- +/*
- + * logicpd-new-product-id
- + *
- + * Copyright (C) 2017 Logic Product Development, Inc.
- + * Adam Ford <adam.ford@logicpd.com>
- + *
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License version 2 as
- + * published by the Free Software Foundation.
- + */
- +
- +#include <linux/init.h>
- +#include <linux/module.h>
- +#include <linux/device.h>
- +#include <linux/syscalls.h>
- +#include <linux/fcntl.h>
- +#include <linux/fs.h>
- +#include <linux/slab.h>
- +#include <asm/uaccess.h> // Needed by segment descriptors
- +
- +//#define EEPROM_PATH "/home/aford/src/lpd_id_module/dm37torp.hex"
- +#define EEPROM_PATH "/sys/devices/platform/68000000.ocp/48060000.i2c/i2c-2/2-0050/eeprom"
- +//#define EEPROM_PATH "/sys/devices/soc0/soc/2100000.aips-bus/21a8000.i2c/i2c-2/2-0051/eeprom"
- +
- +//FIXME: Make this a character pointer and malloc the memory in the kernel driver
- +unsigned char id_data_buf[1024];
- +
- +
- +// This is for debugging purposes only. Set to zero to deactivate.
- +#define SPOOF_VERSION_CODE 0
- +
- +#ifdef DEBUG
- +#define DPRINTF(fmt, args...) printk(KERN_DBG fmt, ## args)
- +#else
- +#define DPRINTF(fmt, ...)
- +#endif
- +
- +#undef ID_KEY_STRINGS
- +#define ID_KEY_ENUMS
- +
- +#undef ID_KEY_START
- +#undef ID_KEY_ENTRY
- +#undef ID_KEY_END
- +
- +#if defined(ID_KEY_STRINGS)
- +/* This is the usage to build the keys for the compiler; we define
- + * an array of strings whose index is the value */
- +#define ID_KEY_START static char *id_keys[] = {
- +#define ID_KEY_ENTRY(XX) #XX ,
- +#define ID_KEY_END };
- +#elif defined(ID_KEY_ENUMS)
- +/* This is the usage by people using the library to access the data */
- +#define ID_KEY_START typedef enum {
- +#define ID_KEY_ENTRY(XX) ID_KEY_ ## XX,
- +#define ID_KEY_END } id_keys_t;
- +#else
- +#error "Need either ID_KEY_INTERFACE or ID_KEY_COMPILER defined!"
- +#endif
- +
- +/* There are some implied conventions here: */
- +/* - names of keys that contain other keys (dictionaries) end in "_group" */
- +/* - names of keys that provide a register setting end in "_reg" */
- +/* - any keys that specify a unit of measure, include units in the name (ie. _mhz, _degf, _bytes) */
- +
- +ID_KEY_START
- +
- +/* Manufacturing unique data for each SOM */
- +ID_KEY_ENTRY(serialization_group)
- +ID_KEY_ENTRY(serial_number)
- +ID_KEY_ENTRY(wifi_ethaddr1)
- +ID_KEY_ENTRY(wifi_ethaddr2)
- +ID_KEY_ENTRY(wifi_ethaddr3)
- +ID_KEY_ENTRY(wifi_ethaddr4)
- +ID_KEY_ENTRY(nvs)
- +
- +/* BOM Model number infromation */
- +ID_KEY_ENTRY(model_group)
- +ID_KEY_ENTRY(model_name)
- +ID_KEY_ENTRY(part_number)
- +ID_KEY_ENTRY(version_code)
- +ID_KEY_ENTRY(hardware_platform)
- +
- +/* CPU specific information */
- +ID_KEY_ENTRY(cpu0_group)
- +ID_KEY_ENTRY(type)
- +ID_KEY_ENTRY(number)
- +ID_KEY_ENTRY(speed_mhz)
- +ID_KEY_ENTRY(temp_class)
- +
- +/* CPU bus information */
- +ID_KEY_ENTRY(cpu0_bus_group)
- +
- +/* DRAM bus information */
- +ID_KEY_ENTRY(dram_bus_group)
- +ID_KEY_ENTRY(sysconfig_reg)
- +ID_KEY_ENTRY(sharing_reg)
- +ID_KEY_ENTRY(dlla_ctrl_reg)
- +ID_KEY_ENTRY(cs_cfg_reg)
- +// ID_KEY_ENTRY(cs0_group) Used in the dram_bus_group, but key defined below after local_bus_group
- +// ID_KEY_ENTRY(cs1_group) Used in the dram_bus_group, but key defined below after local_bus_group
- +ID_KEY_ENTRY(mcfg_reg)
- +ID_KEY_ENTRY(mr_reg)
- +ID_KEY_ENTRY(rfr_ctrl_reg)
- +ID_KEY_ENTRY(emr2_reg)
- +ID_KEY_ENTRY(actim_ctrla_reg)
- +ID_KEY_ENTRY(actim_ctrlb_reg)
- +ID_KEY_ENTRY(power_reg)
- +
- +/* GPMC keys */
- +ID_KEY_ENTRY(local_bus_group)
- +ID_KEY_ENTRY(cs0_group)
- +ID_KEY_ENTRY(cs1_group)
- +ID_KEY_ENTRY(cs2_group)
- +ID_KEY_ENTRY(cs3_group)
- +ID_KEY_ENTRY(cs4_group)
- +ID_KEY_ENTRY(cs5_group)
- +ID_KEY_ENTRY(cs6_group)
- +ID_KEY_ENTRY(config1_reg)
- +ID_KEY_ENTRY(config2_reg)
- +ID_KEY_ENTRY(config3_reg)
- +ID_KEY_ENTRY(config4_reg)
- +ID_KEY_ENTRY(config5_reg)
- +ID_KEY_ENTRY(config6_reg)
- +ID_KEY_ENTRY(config7_reg)
- +
- +/* Manufacturing unique data for each SOM */
- +ID_KEY_ENTRY(lan_ethaddr1)
- +ID_KEY_ENTRY(lan_ethaddr2)
- +ID_KEY_ENTRY(lan_ethaddr3)
- +ID_KEY_ENTRY(lan_ethaddr4)
- +
- +/* End of keys */
- +ID_KEY_END
- +
- +typedef enum {
- + /* Number */
- + IDENUM_NEG_NUM = 0,
- + IDENUM_POS_NUM,
- +
- + /* String/Hex String */
- + IDENUM_STR,
- + IDENUM_HEXSTR,
- +
- + /* Array */
- + IDENUM_ARRAY,
- +
- + /* Dictionary */
- + IDENUM_DICT,
- +
- + /* Key */
- + IDENUM_KEY,
- +
- + /* Any string */
- + IDENUM_ANY_STRING,
- +
- + /* Any number */
- + IDENUM_ANY_NUMBER,
- +
- +} idenum_t;
- +
- +/* structure of builtin keys */
- +struct id_key {
- + unsigned char *ptr;
- + unsigned int size;
- +};
- +
- +#define ID_EOK 0 /* Okay */
- +#define ID_ENOENT 2 /* No such key */
- +#define ID_ENOMEM 12 /* Out of memory */
- +#define ID_EACCES 13 /* Permission denied */
- +#define ID_ENODEV 19 /* No such device */
- +#define ID_EINVAL 22 /* Invalid arcument */
- +#define ID_EDOM 33 /* argument out of domain of func */
- +#define ID_ERANGE 34 /* Out of range */
- +#define ID_EL2NSYNC 45 /* Level 2 not synchronized */
- +#define ID_ENOMEDIUM 123 /* No medium found */
- +
- +static int valid_product_id_lan_ethaddr; // !0 if LAN ethaddr is good
- +static int valid_product_id_wifi_ethaddr; // !0 if LAN ethaddr is good
- +static int valid_product_id_has_wifi_config_data; // !0 if has Murata
- +static int valid_product_id_ddr_timings; // !0 if has ddr_timings
- +
- +/*
- + * return a byte from the ID data at offset 'offset' and set *oor to zero
- + * if offset is in range of the device. If offset is out of range then
- + * set *oor to non-zero
- + */
- +
- +static unsigned char id_fetch_byte(int offset, int *oor)
- +{
- + unsigned char *p = (unsigned char *)&id_data_buf;
- + if (offset < (32<<10)) {
- + *oor = ID_EOK;
- + return p[offset];
- + }
- +
- + *oor = -ID_ERANGE;
- + return 0;
- +}
- +
- +struct id_data {
- + unsigned int root_size;
- + unsigned int root_offset;
- +};
- +
- +/* Function to do the intial startup (i.e. figure out how much data, offset of
- + * key table, etc */
- +static int id_startup(struct id_data *data);
- +/*
- + * Functions provided back to callers for use in accessing data
- + */
- +
- +/* ID data "cookie" used to access data; ultimately this will be opaque
- + * to the callers as they don't need to know whats in it, just pass it around
- + */
- +struct id_cookie {
- + unsigned int start_offset; /* start offset from beginning of data */
- + unsigned int size; /* size of data in bytes */
- + unsigned int offset; /* current read offset */
- +};
- +
- +/* Initialize the cookie to cover the whole root dictionary */
- +static int id_init_cookie(struct id_data *data, struct id_cookie *cookie);
- +
- +/* What is the read pointer cookie is pointing at */
- +static int id_whatis(struct id_cookie *cookie, idenum_t *type);
- +
- +/* User interface functions */
- +
- +static int id_dict_find_key(struct id_cookie *cookie, id_keys_t key);
- +static int id_find_dict(struct id_cookie *cookie, id_keys_t key, idenum_t type);
- +static int id_find_string(struct id_cookie *cookie, id_keys_t key, unsigned char *str_ptr, unsigned int *str_size);
- +static int id_find_number(struct id_cookie *cookie, id_keys_t key, int *num);
- +static int id_find_numbers(struct id_cookie *cookie, id_keys_t *key, int key_size, int *nums);
- +
- +/*
- + * Extract an unsigned packed number, first byte is in 'pack_bits'
- + * of first byte, starting at offset 'offset' */
- +static unsigned int extract_unsigned_pnum(struct id_cookie *cookie, int pack_bits, int *err);
- +static int extract_signed_pnum(struct id_cookie *cookie, int pack_bits, int *err);
- +
- +
- +
- +#define ID_MAX_KEY_SIZE 32
- +
- +static int id_extract_size(struct id_cookie *cookie, int *err);
- +
- +/* struct id_data id_data; */
- +
- +struct __attribute__ ((packed)) id_header {
- + unsigned char signature[4];
- + unsigned char id_fmt_ver;
- + unsigned char unused0;
- + unsigned short data_length;
- +} id_header;
- +
- +struct __attribute__ ((packed)) id_checksums {
- + unsigned short header;
- + unsigned short data;
- +} ;
- +
- +/*
- + * Calculate a CRC-15 of a data buffer passed in
- + */
- +
- +void crc_15_step(unsigned short *crc, unsigned char byte)
- +{
- + int i;
- + unsigned short crcnext;
- +
- + for (i=0; i<7; ++i) {
- + crcnext = (byte & 1) ^ (*crc>>14);
- + *crc = (*crc << 1) & 0x7fff;
- + if (crcnext)
- + *crc ^= 0x4599;
- + byte >>= 1;
- + }
- +}
- +
- +unsigned short crc_15(void *buf, int len)
- +{
- + unsigned char *p = buf;
- + unsigned short xsum = 0;
- + int i;
- +
- + for (i=0; i<len; ++i) {
- + crc_15_step(&xsum, p[i]);
- + }
- + return xsum;
- +}
- +
- +static int id_startup(struct id_data *data)
- +{
- + int i, err;
- + struct id_cookie cookie;
- + unsigned char byte, *p;
- + char *header_tag= "LpId";
- + unsigned short xsum;
- + struct id_header hdr;
- + struct id_checksums xsums;
- +
- + cookie.offset = 0;
- +
- + /* Data starts with the header, should be 'LpId' */
- + for (i=0; i<4; ++i) {
- + byte = id_fetch_byte(cookie.offset, &err);
- + hdr.signature[i] = byte;
- + cookie.offset++;
- + if (err != ID_EOK) {
- + printk(KERN_DEBUG "%s[%u]\n", __FILE__, __LINE__);
- + goto err_ret;
- + }
- + if (hdr.signature[i] != header_tag[i]) {
- + printk(KERN_DEBUG "%s[%u]\n", __FILE__, __LINE__);
- + err = ID_ENODEV;
- + goto err_ret;
- + }
- + }
- +
- + /* First LE 8-bit value is ID format version */
- + hdr.id_fmt_ver = id_fetch_byte(cookie.offset++, &err);
- +
- + /* Second LE 8-bit value is currently not used */
- + hdr.unused0 = id_fetch_byte(cookie.offset++, &err);
- +
- + /* Next LE 16-bit value is length of data */
- + hdr.data_length = id_fetch_byte(cookie.offset++, &err);
- + hdr.data_length |= (id_fetch_byte(cookie.offset++, &err) << 8);
- +
- + /* Next LE 16-bit value is xsum of header */
- + xsums.header = id_fetch_byte(cookie.offset++, &err);
- + xsums.header |= (id_fetch_byte(cookie.offset++, &err) << 8);
- +
- + /* Checksum the header */
- + xsum = crc_15(&hdr, sizeof(hdr));
- + p = (unsigned char *)&hdr;
- + //for (i = 0; i < sizeof(hdr); ++i)
- + // crc_15_step(&xsum, p[i]);
- +
- +
- + if (xsum != xsums.header) {
- + printk(KERN_DEBUG "%s[%u] xsum: 0x%04x, xsums.header: 0x%04x\n",
- + __FILE__, __LINE__, xsum, xsums.header);
- + err = -ID_EL2NSYNC;
- + goto err_ret;
- + }
- +
- + /* Next LE 16-bit value is xsum of data */
- + xsums.data = id_fetch_byte(cookie.offset++, &err);
- + xsums.data |= (id_fetch_byte(cookie.offset++, &err) << 8);
- +
- +
- + /* Checksum the data (next id_len bytes), must match xsums.data */
- + xsum = 0;
- + for (i = 0; i < hdr.data_length; ++i) {
- + byte = id_fetch_byte(cookie.offset + i, &err);
- +
- + if (err != ID_EOK) {
- + printk(KERN_DEBUG "%s[%u]\n", __FILE__, __LINE__);
- + goto err_ret;
- + }
- + crc_15_step(&xsum, byte);
- + }
- + if (xsum != xsums.data) {
- + printk(KERN_DEBUG "%s[%u] xsum: 0x%04x, xsums.data: 0x%04x\n",
- + __FILE__, __LINE__, xsum, xsums.data);
- + err = -ID_EL2NSYNC;
- + goto err_ret;
- + }
- +
- + /* offset is now at the first byte of the root dictionary which
- + contains its span */
- + data->root_offset = cookie.offset;
- + data->root_size = extract_unsigned_pnum(&cookie, 5, &err);
- + if (err != ID_EOK) {
- + printk(KERN_DEBUG "%s[%u]\n", __FILE__, __LINE__);
- + goto err_ret;
- + }
- +
- + data->root_size += cookie.offset - data->root_offset;
- +
- + return ID_EOK;
- +
- +err_ret:
- + return err;
- +}
- +
- +/*
- + * Reset the cookie to cover the whole root dictionary
- + */
- +int id_init_cookie(struct id_data *data, struct id_cookie *cookie)
- +{
- + if (!cookie)
- + return -ID_EINVAL;
- + cookie->start_offset = data->root_offset;
- + cookie->size = data->root_size;
- + cookie->offset = cookie->start_offset;
- + return ID_EOK;
- +}
- +
- +unsigned int extract_unsigned_pnum(struct id_cookie *cookie, int start_bit, int *err)
- +{
- + unsigned int value=0;
- + unsigned int bit_offset=0;
- + unsigned char bits;
- + unsigned char ch;
- + int oor;
- +
- + *err = ID_EOK;
- + for (;;) {
- + ch = id_fetch_byte(cookie->offset++, &oor);
- + if (oor != ID_EOK) {
- + *err = oor;
- + printk(KERN_ERR "extract runs oor");
- + return 0;
- + }
- + if (ch & (1<<(start_bit-1))) {
- + /* more to go, accumulate bits */
- + bits = ch & ((1<<(start_bit - 1)) - 1);
- + value |= (bits << bit_offset);
- + bit_offset += start_bit-1;
- + start_bit = 8;
- + } else {
- + /* last byte of number */
- + bits = ch & ((1<<(start_bit - 1)) - 1);
- + value |= (bits << bit_offset);
- + break;
- + }
- + }
- + return value;
- +}
- +
- +int extract_signed_pnum(struct id_cookie *cookie, int start_bit, int *err)
- +{
- + int value=0;
- + unsigned int bit_offset=0;
- + unsigned char bits;
- + unsigned char ch;
- + int oor;
- +
- + *err = ID_EOK;
- + for (;;) {
- + ch = id_fetch_byte(cookie->offset++, &oor);
- + if (oor != ID_EOK) {
- + *err = oor;
- + printk(KERN_ERR "extract runs oor");
- + return 0;
- + }
- + if (ch & (1<<(start_bit-1))) {
- + /* more to go, accumulate bits */
- + bits = ch & ((1<<(start_bit - 1)) - 1);
- + value |= (bits << bit_offset);
- + bit_offset += start_bit-1;
- + start_bit = 8;
- + } else {
- + /* last byte of number */
- + bits = ch & ((1<<(start_bit - 2)) - 1);
- + value |= (bits << bit_offset);
- + if (ch & (1<<(start_bit - 2)))
- + value = -value;
- + break;
- + }
- + }
- + return value;
- +}
- +
- +int id_whatis(struct id_cookie *cookie, idenum_t *type)
- +{
- + unsigned char byte;
- + int oor;
- + if (!cookie)
- + return -ID_EINVAL;
- +
- + byte = id_fetch_byte(cookie->offset, &oor);
- + if (oor != ID_EOK)
- + return -ID_ERANGE;
- +
- + byte >>= 5;
- + *type = (idenum_t)byte;
- +
- + return ID_EOK;
- +}
- +
- +int id_extract_size(struct id_cookie *cookie, int *err)
- +{
- + idenum_t type;
- + struct id_cookie s_cookie;
- + int size;
- +
- + s_cookie = *cookie;
- +
- + *err = id_whatis(&s_cookie, &type);
- + if (*err != ID_EOK)
- + return *err;
- +
- + switch(type) {
- + case IDENUM_DICT:
- + size = extract_unsigned_pnum(&s_cookie, 5, err);
- + size += (s_cookie.offset - cookie->offset);
- + break;
- + case IDENUM_ARRAY:
- + size = extract_unsigned_pnum(&s_cookie, 5, err);
- + size += (s_cookie.offset - cookie->offset);
- + break;
- + case IDENUM_STR:
- + case IDENUM_HEXSTR:
- + size = extract_unsigned_pnum(&s_cookie, 5, err);
- + size += (s_cookie.offset - cookie->offset);
- + break;
- + case IDENUM_POS_NUM:
- + case IDENUM_NEG_NUM:
- + extract_signed_pnum(&s_cookie, 5, err);
- + size = (s_cookie.offset - cookie->offset);
- + break;
- + case IDENUM_KEY:
- + extract_unsigned_pnum(&s_cookie, 5, err);
- + size = (s_cookie.offset - cookie->offset);
- + break;
- + default:
- + *err = -ID_EDOM;
- + size = 0;
- + break;
- + }
- + if (*err != ID_EOK)
- + return *err;
- +
- + return size;
- +}
- +
- +static int id_extract_key(struct id_cookie *cookie, id_keys_t *key)
- +{
- + int err;
- + id_keys_t keyval;
- +
- + keyval = (id_keys_t)extract_unsigned_pnum(cookie, 5, &err);
- + if (err != ID_EOK)
- + return err;
- + *key = keyval;
- + return ID_EOK;
- +}
- +
- +/* in dictionary that cookie points to find key "key"; if found
- + * update cookie to associated "key" entry and return ID_EOK;
- + * else return -ID_ENOENT */
- +static int id_dict_find_key(struct id_cookie *cookie, id_keys_t key)
- +{
- + int err;
- + unsigned int size;
- + id_keys_t d_key;
- + idenum_t type;
- + struct id_cookie d_cookie = *cookie;
- + struct id_cookie t_cookie;
- +
- + err = id_whatis(cookie, &type);
- + if (err != ID_EOK)
- + return err;
- +
- + /* Header has to be a dictionary */
- + if (type != IDENUM_DICT)
- + return -ID_EINVAL;
- +
- + /* Extract size of dictionary */
- + size = extract_unsigned_pnum(&d_cookie, 5, &err);
- + if (err != ID_EOK)
- + return err;
- +
- + d_cookie.size = size;
- + d_cookie.start_offset = d_cookie.offset;
- +
- + /* cookie->offset is now at first key */
- + while (d_cookie.offset < d_cookie.start_offset + d_cookie.size) {
- + /* Extract the key and move the cookie over key */
- + err = id_extract_key(&d_cookie, &d_key);
- + if (err != ID_EOK)
- + return err;
- + t_cookie = d_cookie;
- + /* move forward over the value */
- + size = id_extract_size(&d_cookie, &err);
- + if (err != ID_EOK)
- + return err;
- + if (key == d_key) {
- + d_cookie.size = size;
- + d_cookie.start_offset = t_cookie.offset;
- + d_cookie.offset = t_cookie.offset;
- + *cookie = d_cookie;
- + return ID_EOK;
- + }
- + d_cookie.offset += size;
- + }
- + return -ID_ENOENT;
- +}
- +
- +/* Are these two types a match? */
- +static int id_match_type(idenum_t type_a, idenum_t type_b)
- +{
- + idenum_t tmp;
- +
- + if (type_a == type_b)
- + return 1;
- +
- + /* Oder the types (so the "*ANY*" types are in type_b) */
- + if ((int)type_a > (int)type_b) {
- + tmp = type_a;
- + type_a = type_b;
- + type_b = tmp;
- + }
- + if (type_b == IDENUM_ANY_STRING && (type_a == IDENUM_STR || type_a == IDENUM_HEXSTR))
- + return 1;
- +
- + if (type_b == IDENUM_ANY_NUMBER && (type_a == IDENUM_NEG_NUM || type_a == IDENUM_POS_NUM))
- + return 1;
- +
- + return 0;
- +}
- +
- +/* Find in dictionary (that cookie points to) key "key" that is type "type" */
- +static int id_find_dict(struct id_cookie *cookie, id_keys_t key, idenum_t type)
- +{
- + int err;
- + struct id_cookie d_cookie = *cookie;
- + idenum_t l_type;
- +
- + err = id_dict_find_key(&d_cookie, key);
- + if (err != ID_EOK)
- + return err;
- + err = id_whatis(&d_cookie, &l_type);
- + if (err != ID_EOK)
- + return err;
- + if (!id_match_type(l_type, type))
- + return -ID_EINVAL;
- + *cookie = d_cookie;
- + return ID_EOK;
- +}
- +
- +/* in dictionary pointed at by cookie, find the key "key"; verify its a
- + * string and copy its value */
- +static int id_find_string(struct id_cookie *cookie, id_keys_t key, unsigned char *str_ptr, unsigned int *str_size)
- +{
- + int err, i;
- + unsigned char byte;
- + unsigned int size;
- + struct id_cookie d_cookie = *cookie;
- +
- + err = id_find_dict(&d_cookie, key, IDENUM_ANY_STRING);
- +
- + if (err != ID_EOK)
- + return err;
- + /* Extract the string size */
- + size = extract_unsigned_pnum(&d_cookie, 5, &err);
- + if (err != ID_EOK)
- + return err;
- +
- + /* If handed a NULL str_ptr, only set the size and return */
- + if (!str_ptr) {
- + *str_size = size;
- + return ID_EOK;
- + }
- +
- + if (size > *str_size)
- + return -ID_ERANGE;
- +
- + for(i=0; i<size; ++i) {
- + byte = id_fetch_byte(d_cookie.offset++, &err);
- + if (err)
- + return err;
- + str_ptr[i] = byte;
- + }
- + *str_size = size;
- +
- + return ID_EOK;
- +}
- +
- +/* in dictionary pointed at by cookie, find the key "key"; verify its a
- + * number (either pos/neg) and return its value through *num */
- +static int id_find_number(struct id_cookie *cookie, id_keys_t key, int *num)
- +{
- + int err;
- + int l_num;
- + idenum_t l_type;
- + struct id_cookie d_cookie = *cookie;
- +
- + err = id_find_dict(&d_cookie, key, IDENUM_ANY_NUMBER);
- +
- + if (err != ID_EOK)
- + return err;
- + err = id_whatis(&d_cookie, &l_type);
- + if (err != ID_EOK)
- + return err;
- + /* Extract the number size */
- +#if SPOOF_VERSION_CODE
- + if ((cookie->offset == 509) && (key == ID_KEY_version_code))
- + {
- + *num = SPOOF_VERSION_CODE;
- + return ID_EOK;
- + }
- +#endif
- + l_num = extract_unsigned_pnum(&d_cookie, 5, &err);
- + if (err != ID_EOK)
- + return err;
- +
- + if (l_type == IDENUM_NEG_NUM)
- + l_num = -l_num;
- +
- + *num = l_num;
- + return ID_EOK;
- +}
- +
- +/* in dictionary pointed at by cookie, find the list of keys; verify they are
- + * numbers (either pos/neg) and return their value through *nums */
- +static int id_find_numbers(struct id_cookie *cookie, id_keys_t *keys, int key_size, int *nums)
- +{
- + int i, err;
- + struct id_cookie d_cookie;
- +
- + for (i=0;i<key_size; ++i) {
- + d_cookie = *cookie;
- + err = id_find_number(&d_cookie, keys[i], &nums[i]);
- + if (err != ID_EOK)
- + return err;
- + }
- + return ID_EOK;
- +}
- +
- +/* --------------------------------------------------------- */
- +
- +/*
- + * Here down is the code to interface to the kernel to extract product
- + * ID information from the SRAM/AT24 chip.
- + */
- +
- +struct id_data id_data;
- +static int found_id_data;
- +static struct id_cookie cpu0_group_cookie;
- +static struct id_cookie serialization_group_cookie;
- +static struct id_cookie model_group_cookie;
- +
- +static int omap3logic_find_model_group_cookie(struct id_cookie *mg_cookie)
- +{
- + int ret;
- + struct id_cookie cookie;
- +
- + if (!found_id_data) {
- + return -1;
- + }
- +
- + if (model_group_cookie.offset) {
- + *mg_cookie = model_group_cookie;
- + return ID_EOK;
- + }
- +
- + /* Reinitialise cookie back to the root */
- + ret = id_init_cookie(&id_data, &cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + /* find /model_group from root */
- + ret = id_find_dict(&cookie, ID_KEY_model_group, IDENUM_DICT);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + model_group_cookie = cookie;
- + *mg_cookie = cookie;
- + return ret;
- +}
- +
- +static int omap3logic_find_serialization_cookie(struct id_cookie *s_cookie)
- +{
- + int ret;
- + struct id_cookie cookie;
- +
- + if (!found_id_data) {
- + return -1;
- + }
- +
- + if (serialization_group_cookie.offset) {
- + *s_cookie = serialization_group_cookie;
- + return ID_EOK;
- + }
- +
- + ret = id_init_cookie(&id_data, &cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + /* find /serialization_group from root */
- + ret = id_find_dict(&cookie, ID_KEY_serialization_group, IDENUM_DICT);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + serialization_group_cookie = cookie;
- + *s_cookie = cookie;
- + return ID_EOK;
- +}
- +
- +static int omap3logic_find_cpu0_group_cookie(struct id_cookie *s_cookie)
- +{
- + int ret;
- + struct id_cookie cookie;
- +
- + if (!found_id_data) {
- + return -1;
- + }
- +
- + if (cpu0_group_cookie.offset) {
- + *s_cookie = cpu0_group_cookie;
- + return ID_EOK;
- + }
- +
- + ret = id_init_cookie(&id_data, &cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + /* find /cpu0_group from root */
- + ret = id_find_dict(&cookie, ID_KEY_cpu0_group, IDENUM_DICT);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + cpu0_group_cookie = cookie;
- + *s_cookie = cookie;
- + return ID_EOK;
- +}
- +
- +int omap3logic_extract_new_part_number(u32 *part_number)
- +{
- + int ret;
- + struct id_cookie cookie;
- +
- + ret = omap3logic_find_model_group_cookie(&cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + /* Find part number */
- + ret = id_find_number(&cookie, ID_KEY_part_number, part_number);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- + return ret;
- +}
- +
- +int omap3logic_extract_new_version_code(u32 *version_code)
- +{
- + int ret;
- + struct id_cookie cookie;
- +
- + ret = omap3logic_find_model_group_cookie(&cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return -EINVAL;
- + }
- +
- + /* Find part number */
- + ret = id_find_number(&cookie, ID_KEY_version_code, version_code);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return -EINVAL;
- + }
- + return ret;
- +}
- +
- +int omap3logic_extract_new_speed_mhz(u32 *speed_mhz)
- +{
- + int ret;
- + struct id_cookie cookie;
- +
- + ret = omap3logic_find_cpu0_group_cookie(&cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + /* Find part number */
- + ret = id_find_number(&cookie, ID_KEY_speed_mhz, speed_mhz);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- + return ret;
- +}
- +
- +struct ddr_timings {
- + u32 sysconfig;
- + u32 sharing;
- + u32 power;
- + u32 cfg;
- + struct ddr_cs {
- + u32 mcfg;
- + u32 mr;
- + u32 rfr;
- + u32 emr;
- + u32 actima;
- + u32 actimb;
- + u32 dlla;
- + } cs;
- +} ddr_timings;
- +
- +id_keys_t dram_cs_group_keys[] = {
- + ID_KEY_mcfg_reg,
- + ID_KEY_mr_reg,
- + ID_KEY_rfr_ctrl_reg,
- + ID_KEY_emr2_reg,
- + ID_KEY_actim_ctrla_reg,
- + ID_KEY_actim_ctrlb_reg,
- + ID_KEY_dlla_ctrl_reg,
- +};
- +id_keys_t dram_bus_group_keys[] = {
- + ID_KEY_sysconfig_reg,
- + ID_KEY_sharing_reg,
- + ID_KEY_power_reg,
- + ID_KEY_cs_cfg_reg,
- +};
- +
- +int omap3logic_extract_new_ddr_timings(struct ddr_timings *ddr_timings)
- +{
- + int ret;
- + struct id_cookie cookie, dram_bus_group_cookie;
- + int dram_bus_group_values[ARRAY_SIZE(dram_bus_group_keys)];
- + int dram_cs_group_values[ARRAY_SIZE(dram_cs_group_keys)];
- +
- + ret = id_init_cookie(&id_data, &cookie);
- + if (ret != ID_EOK) {
- + return ret;
- + }
- +
- + /* find /cpu0_bus_group from root */
- + ret = id_find_dict(&cookie, ID_KEY_cpu0_bus_group, IDENUM_DICT);
- + if (ret != ID_EOK) {
- + return ret;
- + }
- +
- + /* find /dram_bus_group from /cpu0_bus_group */
- + ret = id_find_dict(&cookie, ID_KEY_dram_bus_group, IDENUM_DICT);
- + if (ret != ID_EOK) {
- + return ret;
- + }
- +
- + dram_bus_group_cookie = cookie;
- + ret = id_find_numbers(&dram_bus_group_cookie, dram_bus_group_keys, ARRAY_SIZE(dram_bus_group_keys), dram_bus_group_values);
- + if (ret != ID_EOK) {
- + return ret;
- + }
- +
- + ddr_timings->sysconfig = dram_bus_group_values[0];
- + ddr_timings->sharing = dram_bus_group_values[1];
- + ddr_timings->power = dram_bus_group_values[2];
- + ddr_timings->cfg = dram_bus_group_values[3];
- +
- + ret = id_find_dict(&dram_bus_group_cookie, ID_KEY_cs0_group, IDENUM_DICT);
- + if (ret != ID_EOK) {
- + return ret;
- + }
- +
- + ret = id_find_numbers(&dram_bus_group_cookie, dram_cs_group_keys, ARRAY_SIZE(dram_cs_group_keys), dram_cs_group_values);
- + if (ret != ID_EOK) {
- + return ret;
- + }
- + ddr_timings->cs.mcfg = dram_cs_group_values[0];
- + ddr_timings->cs.mr = dram_cs_group_values[1];
- + ddr_timings->cs.rfr = dram_cs_group_values[2];
- + ddr_timings->cs.emr = dram_cs_group_values[3];
- + ddr_timings->cs.actima = dram_cs_group_values[4];
- + ddr_timings->cs.actimb = dram_cs_group_values[5];
- + ddr_timings->cs.dlla = dram_cs_group_values[6];
- +
- + return ret;
- +}
- +
- +static int omap3logic_extract_new_model_name(char *model_name, u32 *model_name_size)
- +{
- + int ret;
- + struct id_cookie cookie;
- +
- + ret = omap3logic_find_model_group_cookie(&cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + ret = id_find_string(&cookie, ID_KEY_model_name, model_name, model_name_size);
- + if (ret != ID_EOK) {
- + if (ret != -ID_ENOENT) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + }
- + return ret;
- + }
- +
- + return ret;
- +}
- +
- +int omap3logic_extract_new_serial_number(u8 *serial_number, u32 *serial_number_size)
- +{
- + int ret;
- + struct id_cookie cookie;
- +
- + ret = omap3logic_find_serialization_cookie(&cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + /* Find serial_number */
- + ret = id_find_string(&cookie, ID_KEY_serial_number, serial_number, serial_number_size);
- + if (ret != ID_EOK) {
- + if (ret != -ID_ENOENT)
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + return ret;
- +}
- +
- +int omap3logic_extract_new_nvs_data(u8 *nvs_data, u32 *nvs_data_size)
- +{
- + int ret;
- + struct id_cookie cookie;
- +
- + ret = omap3logic_find_serialization_cookie(&cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- +
- + /* Find serial_number */
- + ret = id_find_string(&cookie, ID_KEY_nvs, nvs_data, nvs_data_size);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d ret %d\n", __FUNCTION__, __LINE__, ret);
- + return ret;
- + }
- + return ret;
- +}
- +
- +#if 0
- +/* Extract GPMC timings for particular CS register */
- +id_keys_t gpmc_ncs_keys[] = {
- + ID_KEY_cs0_group,
- + ID_KEY_cs1_group,
- + ID_KEY_cs2_group,
- + ID_KEY_cs3_group,
- + ID_KEY_cs4_group,
- + ID_KEY_cs5_group,
- + ID_KEY_cs6_group,
- +};
- +
- +id_keys_t gpmc_config_reg_keys[] = {
- + ID_KEY_config1_reg,
- + ID_KEY_config2_reg,
- + ID_KEY_config3_reg,
- + ID_KEY_config4_reg,
- + ID_KEY_config5_reg,
- + ID_KEY_config6_reg,
- + ID_KEY_config7_reg,
- +};
- +
- +#endif
- +
- +/* Initialize the product ID data and return 0 if found */
- +static int product_id_init(void)
- +{
- + int ret;
- +
- + memset(&id_data, 0, sizeof(id_data));
- +
- + ret = id_startup(&id_data);
- + if (ret != ID_EOK) {
- + return -1;
- + }
- +
- + return 0;
- +}
- +
- +static int logic_has_new_product_id(void)
- +{
- + if (!found_id_data) {
- + if (!product_id_init()) {
- + found_id_data = 1;
- + }
- + }
- + return found_id_data;
- +}
- +
- +static int omap3logic_init_new_product_id(void)
- +{
- + if (!logic_has_new_product_id()) {
- + printk(KERN_ERR "%s:%d\n", __FUNCTION__, __LINE__);
- + return -ENOENT;
- + }
- +
- + return 0;
- +}
- +
- +/* Extract the Wired LAN ethaddr, and return !0 if its valid */
- +static int omap3logic_extract_new_lan_ethaddr(u8 *ethaddr)
- +{
- + int ret;
- + struct id_cookie cookie;
- + int ethaddr_size;
- +
- + if (!found_id_data) {
- + ret = -ENXIO;
- + printk(KERN_ERR "%s:%d\n", __FUNCTION__, __LINE__);
- + goto done;
- + }
- +
- + ret = id_init_cookie(&id_data, &cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d\n", __FUNCTION__, __LINE__);
- + goto done;
- + }
- +
- + /* Find /serialization_group */
- + ret = id_find_dict(&cookie, ID_KEY_serialization_group, IDENUM_DICT);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d\n", __FUNCTION__, __LINE__);
- + goto done;
- + }
- +
- + /* Find /lan_ethaddr1 */
- + ethaddr_size = 6;
- + ret = id_find_string(&cookie, ID_KEY_lan_ethaddr1, ethaddr, ðaddr_size);
- + if (ret != ID_EOK) {
- + goto done;
- + }
- + if (ethaddr_size != 6) {
- + ret = -E2BIG;
- + printk(KERN_ERR "%s:%d ethaddr_size %u\n", __FUNCTION__, __LINE__, ethaddr_size);
- + goto done;
- + }
- + ret = 0;
- +
- +done:
- + return ret;
- +}
- +
- +/* Extract the WiFi ethaddr, and return !0 if its valid */
- +static int omap3logic_extract_new_wifi_ethaddr(u8 *ethaddr)
- +{
- + int ret;
- + struct id_cookie cookie;
- + int ethaddr_size;
- +
- + if (!found_id_data) {
- + ret = -ENXIO;
- + printk(KERN_ERR "%s:%d\n", __FUNCTION__, __LINE__);
- + goto done;
- + }
- +
- + ret = id_init_cookie(&id_data, &cookie);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d\n", __FUNCTION__, __LINE__);
- + goto done;
- + }
- +
- + /* Find /serialization_group */
- + ret = id_find_dict(&cookie, ID_KEY_serialization_group, IDENUM_DICT);
- + if (ret != ID_EOK) {
- + printk(KERN_ERR "%s:%d\n", __FUNCTION__, __LINE__);
- + goto done;
- + }
- +
- + /* Find /lan_ethaddr2 */
- + ethaddr_size = 6;
- + ret = id_find_string(&cookie, ID_KEY_wifi_ethaddr1, ethaddr, ðaddr_size);
- + if (ret != ID_EOK) {
- + goto done;
- + }
- + if (ethaddr_size != 6) {
- + ret = -E2BIG;
- + printk(KERN_ERR "%s:%d ethadr_size %d\n", __FUNCTION__, __LINE__, ethaddr_size);
- + goto done;
- + }
- +
- + ret = 0;
- +done:
- + return ret;
- +}
- +
- +static ssize_t product_id_show_wifi_macaddr(struct class *class, struct class_attribute *attr, char *buf)
- +{
- + u8 macaddr[7];
- + int ret;
- + int len;
- +
- + ret = omap3logic_extract_new_wifi_ethaddr(macaddr);
- + if (!ret) {
- + len = sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x\n",
- + macaddr[0], macaddr[1], macaddr[2],
- + macaddr[3], macaddr[4], macaddr[5]);
- + }
- + return len;
- +}
- +
- +static ssize_t product_id_show_lan_macaddr(struct class *class, struct class_attribute *attr, char *buf)
- +{
- + u8 macaddr[7];
- + int ret;
- + int len;
- +
- + ret = omap3logic_extract_new_lan_ethaddr(macaddr);
- + if (!ret) {
- + len = sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x\n",
- + macaddr[0], macaddr[1], macaddr[2],
- + macaddr[3], macaddr[4], macaddr[5]);
- + }
- + return len;
- +}
- +
- +static ssize_t product_id_show_part_number(struct class *class, struct class_attribute *attr, char *buf)
- +{
- + u32 part_number;
- + int len;
- +
- + omap3logic_extract_new_part_number(&part_number);
- + len = sprintf(buf, "%d\n", part_number);
- + return len;
- +}
- +
- +static ssize_t product_id_show_model_name(struct class *class, struct class_attribute *attr, char *buf)
- +{
- + u32 model_name_size = 128;
- + int ret;
- +
- + ret = omap3logic_extract_new_model_name((u8 *)buf, &model_name_size);
- +
- + buf[model_name_size] = '\n';
- + return model_name_size + 1;
- +}
- +
- +static ssize_t product_id_show_version_code(struct class *class, struct class_attribute *attr, char *buf)
- +{
- + u32 version_code;
- + int len;
- +
- + omap3logic_extract_new_version_code(&version_code);
- + len = sprintf(buf, "%u\n", version_code);
- + return len;
- +}
- +
- +static ssize_t product_id_show_serial_number(struct class *class, struct class_attribute *attr, char *buf)
- +{
- + u32 serial_number_size = 128;
- +
- + omap3logic_extract_new_serial_number((u8 *)buf, &serial_number_size);
- + buf[serial_number_size] = '\n';
- + return serial_number_size + 1;
- +}
- +
- +static ssize_t product_id_show_speed_mhz(struct class *clase, struct class_attribute *attr, char *buf)
- +{
- + u32 speed_mhz;
- + int len;
- +
- + omap3logic_extract_new_speed_mhz(&speed_mhz);
- + len = sprintf(buf, "%u\n", speed_mhz);
- + return len;
- +}
- +
- +static ssize_t product_id_show_wifi_config_data(struct class *class, struct class_attribute *attr, char *buf)
- +{
- + u32 wifi_config_size = PAGE_SIZE;
- + int ret;
- +
- + ret = omap3logic_extract_new_nvs_data(buf, &wifi_config_size);
- +
- + if (ret == ID_EOK)
- + return wifi_config_size;
- +
- + return ret;
- +}
- +
- +#define DUMP_DDR_TIMING(REG) i += sprintf(&buf[i], "%-9s: %08x\n", #REG, ddr_timings. REG)
- +static ssize_t product_id_show_ddr_timings(struct class *class, struct class_attribute *attr, char *buf)
- +{
- + int i=0;
- +
- + DUMP_DDR_TIMING(sysconfig);
- + DUMP_DDR_TIMING(sharing);
- + DUMP_DDR_TIMING(power);
- + DUMP_DDR_TIMING(cfg);
- + DUMP_DDR_TIMING(cs.mcfg);
- + DUMP_DDR_TIMING(cs.mr);
- + DUMP_DDR_TIMING(cs.rfr);
- + DUMP_DDR_TIMING(cs.emr);
- + DUMP_DDR_TIMING(cs.actima);
- + DUMP_DDR_TIMING(cs.actimb);
- + DUMP_DDR_TIMING(cs.dlla);
- +
- + return i;
- +}
- +
- +static struct {
- + struct class_attribute attr;
- + int *test_value;
- +} product_id_class_attributes[] = {
- + {
- + __ATTR(lan_macaddr, S_IRUGO, product_id_show_lan_macaddr, NULL),
- + NULL,
- + },
- + {
- + __ATTR(wifi_macaddr, S_IRUGO, product_id_show_wifi_macaddr, NULL),
- + NULL,
- + },
- + {
- + __ATTR(part_number, S_IRUGO, product_id_show_part_number, NULL),
- + NULL,
- + },
- + {
- + __ATTR(version_code, S_IRUGO, product_id_show_version_code, NULL),
- + NULL,
- + },
- + {
- + __ATTR(model_name, S_IRUGO, product_id_show_model_name, NULL),
- + NULL,
- + },
- + {
- + __ATTR(serial_number, S_IRUGO, product_id_show_serial_number, NULL),
- + NULL,
- + },
- + {
- + __ATTR(speed_mhz, S_IRUGO, product_id_show_speed_mhz, NULL),
- + NULL,
- + },
- + {
- + __ATTR(wifi_config_data, S_IRUGO, product_id_show_wifi_config_data, NULL),
- + NULL,
- + },
- + {
- + __ATTR(ddr_timings, S_IRUGO, product_id_show_ddr_timings, NULL),
- + NULL,
- + },
- +};
- +
- +static void product_id_dev_release(struct device *dev)
- +{
- +}
- +
- +static struct class product_id_class = {
- + .name = "product_id",
- + .dev_release = product_id_dev_release,
- +};
- +
- +static int omap3logic_create_new_product_id_sysfs(void)
- +{
- + int i, rc;
- +
- + rc = class_register(&product_id_class);
- + if (rc != 0) {
- + printk(KERN_ERR "%s: failed to register product_id class\n", __FUNCTION__);
- + return rc;
- + }
- +
- + for (i=0; i<ARRAY_SIZE(product_id_class_attributes); ++i) {
- + if (!product_id_class_attributes[i].test_value || *product_id_class_attributes[i].test_value) {
- + rc = class_create_file(&product_id_class, &product_id_class_attributes[i].attr);
- + if (unlikely(rc)) {
- + printk(KERN_ERR "%s: failed to create product_id class file\n", __FUNCTION__);
- + while (--i >= 0) {
- + if (!product_id_class_attributes[i].test_value || *product_id_class_attributes[i].test_value) {
- + class_remove_file(&product_id_class, &product_id_class_attributes[i].attr);
- + }
- + }
- + class_unregister(&product_id_class);
- + return -EPERM;
- + }
- + }
- + }
- +
- + return 0;
- +}
- +
- +static int omap3logic_extract_nvs_data(u8 *nvs_data, u32 *nvs_data_size)
- +{
- + return omap3logic_extract_new_nvs_data(nvs_data, nvs_data_size);
- +}
- +/* Extract the version code for the SOM */
- +int omap3logic_extract_version_code(void)
- +{
- + int err;
- + u32 version_code;
- +
- + err = omap3logic_extract_new_version_code(&version_code);
- + if (!err)
- + return version_code;
- +
- + return -EINVAL;
- +}
- +
- +#ifdef EEPROM_PATH
- +static int read_eeprom(void)
- +{
- +
- + struct file *f;
- + mm_segment_t fs;
- + loff_t pos = 0;
- + int ret = 0;
- + long sz;
- +
- + struct id_header hdr;
- + struct id_checksums xsums;
- +
- +
- + f = filp_open(EEPROM_PATH, O_RDONLY, 0);
- + if(f == NULL)
- + printk(KERN_ALERT "filp_open error!!.\n");
- + else{
- + fs = get_fs();
- + set_fs(get_ds());
- +
- + /* Read the header */
- + sz = sizeof(hdr);
- + vfs_read(f, (void *)&hdr, sz, &pos);
- +
- + /* Read the checksums */
- + sz = sizeof(xsums);
- + vfs_read(f, (void *)&xsums, sz, &pos);
- +
- + /* Size of data = header + 2 LE Checksums + data_length */
- + sz = sizeof(hdr) + sizeof(xsums) + hdr.data_length;
- +
- + /* FIXME: Make the MALLOC work in the kernel */
- + /* id_data_buf = (char *)kmalloc(sz, GFP_KERNEL); */
- +
- + /* Copy the header into the final space */
- + memcpy(&id_data_buf[0], &hdr, sizeof(hdr));
- +
- + /* Copy the checksums into the final space */
- + memcpy(&(id_data_buf[sizeof(hdr)]), &xsums, sizeof(xsums));
- +
- + /* Only read the data_length worth of data */
- + sz = hdr.data_length;
- + vfs_read(f, (void *)&id_data_buf[sizeof(hdr) + sizeof(xsums)], sz, &pos);
- + set_fs(fs);
- + }
- + filp_close(f,NULL);
- + return ret;
- +}
- +#endif
- +
- +static int __init productid_init(void)
- +{
- +#ifdef EEPROM_PATH
- + read_eeprom();
- +#endif
- + omap3logic_init_new_product_id();
- + omap3logic_create_new_product_id_sysfs();
- + return 0;
- +}
- +
- +module_init(productid_init);
- +
- +static void __exit productid_exit(void)
- +{
- + int i;
- +
- + for (i=0; i<ARRAY_SIZE(product_id_class_attributes); ++i) {
- + class_remove_file(&product_id_class, &product_id_class_attributes[i].attr);
- + }
- + class_unregister(&product_id_class);
- +}
- +
- +module_exit(productid_exit);
- +
- +EXPORT_SYMBOL(omap3logic_extract_nvs_data);
- +EXPORT_SYMBOL(omap3logic_extract_version_code);
- +
- +MODULE_LICENSE("GPL");
- +MODULE_AUTHOR("Adam Ford <adam.ford@logicpd.com>");
- +MODULE_DESCRIPTION("Logic PD EEPROM reader");
- +MODULE_VERSION("printk");
- +
- diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
- index 2f4641a..3deb642 100644
- --- a/drivers/pwm/Kconfig
- +++ b/drivers/pwm/Kconfig
- @@ -270,6 +270,15 @@ config PWM_MXS
- To compile this driver as a module, choose M here: the module
- will be called pwm-mxs.
- +config PWM_OMAP_DMTIMER
- + tristate "OMAP Dual-Mode Timer PWM support"
- + depends on OF && ARCH_OMAP && OMAP_DM_TIMER
- + help
- + Generic PWM framework driver for OMAP Dual-Mode Timer PWM output
- +
- + To compile this driver as a module, choose M here: the module
- + will be called pwm-omap-dmtimer
- +
- config PWM_PCA9685
- tristate "NXP PCA9685 PWM driver"
- depends on I2C
- diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
- index 69b8275..dd35bc1 100644
- --- a/drivers/pwm/Makefile
- +++ b/drivers/pwm/Makefile
- @@ -24,6 +24,7 @@ obj-$(CONFIG_PWM_LPSS_PCI) += pwm-lpss-pci.o
- obj-$(CONFIG_PWM_LPSS_PLATFORM) += pwm-lpss-platform.o
- obj-$(CONFIG_PWM_MTK_DISP) += pwm-mtk-disp.o
- obj-$(CONFIG_PWM_MXS) += pwm-mxs.o
- +obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o
- obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o
- obj-$(CONFIG_PWM_PUV3) += pwm-puv3.o
- obj-$(CONFIG_PWM_PXA) += pwm-pxa.o
- diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
- new file mode 100644
- index 0000000..b7e6ecb
- --- /dev/null
- +++ b/drivers/pwm/pwm-omap-dmtimer.c
- @@ -0,0 +1,369 @@
- +/*
- + * Copyright (c) 2015 Neil Armstrong <narmstrong@baylibre.com>
- + * Copyright (c) 2014 Joachim Eastwood <manabian@gmail.com>
- + * Copyright (c) 2012 NeilBrown <neilb@suse.de>
- + * Heavily based on earlier code which is:
- + * Copyright (c) 2010 Grant Erickson <marathon96@gmail.com>
- + *
- + * Also based on pwm-samsung.c
- + *
- + * This program is free software; you can redistribute it and/or
- + * modify it under the terms of the GNU General Public License
- + * version 2 as published by the Free Software Foundation.
- + *
- + * Description:
- + * This file is the core OMAP support for the generic, Linux
- + * PWM driver / controller, using the OMAP's dual-mode timers.
- + */
- +
- +#include <linux/clk.h>
- +#include <linux/err.h>
- +#include <linux/kernel.h>
- +#include <linux/module.h>
- +#include <linux/mutex.h>
- +#include <linux/of.h>
- +#include <linux/of_platform.h>
- +#include <linux/platform_data/pwm_omap_dmtimer.h>
- +#include <linux/platform_device.h>
- +#include <linux/pm_runtime.h>
- +#include <linux/pwm.h>
- +#include <linux/slab.h>
- +#include <linux/time.h>
- +
- +#define DM_TIMER_LOAD_MIN 0xfffffffe
- +#define DM_TIMER_MAX 0xffffffff
- +
- +struct pwm_omap_dmtimer_chip {
- + struct pwm_chip chip;
- + struct mutex mutex;
- + pwm_omap_dmtimer *dm_timer;
- + struct pwm_omap_dmtimer_pdata *pdata;
- + struct platform_device *dm_timer_pdev;
- +};
- +
- +static inline struct pwm_omap_dmtimer_chip *
- +to_pwm_omap_dmtimer_chip(struct pwm_chip *chip)
- +{
- + return container_of(chip, struct pwm_omap_dmtimer_chip, chip);
- +}
- +
- +static u32 pwm_omap_dmtimer_get_clock_cycles(unsigned long clk_rate, int ns)
- +{
- + return DIV_ROUND_CLOSEST_ULL((u64)clk_rate * ns, NSEC_PER_SEC);
- +}
- +
- +static void pwm_omap_dmtimer_start(struct pwm_omap_dmtimer_chip *omap)
- +{
- + /*
- + * According to OMAP 4 TRM section 22.2.4.10 the counter should be
- + * started at 0xFFFFFFFE when overflow and match is used to ensure
- + * that the PWM line is toggled on the first event.
- + *
- + * Note that omap_dm_timer_enable/disable is for register access and
- + * not the timer counter itself.
- + */
- + omap->pdata->enable(omap->dm_timer);
- + omap->pdata->write_counter(omap->dm_timer, DM_TIMER_LOAD_MIN);
- + omap->pdata->disable(omap->dm_timer);
- +
- + omap->pdata->start(omap->dm_timer);
- +}
- +
- +static int pwm_omap_dmtimer_enable(struct pwm_chip *chip,
- + struct pwm_device *pwm)
- +{
- + struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
- +
- + mutex_lock(&omap->mutex);
- + pwm_omap_dmtimer_start(omap);
- + mutex_unlock(&omap->mutex);
- +
- + return 0;
- +}
- +
- +static void pwm_omap_dmtimer_disable(struct pwm_chip *chip,
- + struct pwm_device *pwm)
- +{
- + struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
- +
- + mutex_lock(&omap->mutex);
- + omap->pdata->stop(omap->dm_timer);
- + mutex_unlock(&omap->mutex);
- +}
- +
- +static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
- + struct pwm_device *pwm,
- + int duty_ns, int period_ns)
- +{
- + struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
- + u32 period_cycles, duty_cycles;
- + u32 load_value, match_value;
- + struct clk *fclk;
- + unsigned long clk_rate;
- + bool timer_active;
- +
- + dev_dbg(chip->dev, "requested duty cycle: %d ns, period: %d ns\n",
- + duty_ns, period_ns);
- +
- + mutex_lock(&omap->mutex);
- + if (duty_ns == pwm_get_duty_cycle(pwm) &&
- + period_ns == pwm_get_period(pwm)) {
- + /* No change - don't cause any transients. */
- + mutex_unlock(&omap->mutex);
- + return 0;
- + }
- +
- + fclk = omap->pdata->get_fclk(omap->dm_timer);
- + if (!fclk) {
- + dev_err(chip->dev, "invalid pmtimer fclk\n");
- + goto err_einval;
- + }
- +
- + clk_rate = clk_get_rate(fclk);
- + if (!clk_rate) {
- + dev_err(chip->dev, "invalid pmtimer fclk rate\n");
- + goto err_einval;
- + }
- +
- + dev_dbg(chip->dev, "clk rate: %luHz\n", clk_rate);
- +
- + /*
- + * Calculate the appropriate load and match values based on the
- + * specified period and duty cycle. The load value determines the
- + * period time and the match value determines the duty time.
- + *
- + * The period lasts for (DM_TIMER_MAX-load_value+1) clock cycles.
- + * Similarly, the active time lasts (match_value-load_value+1) cycles.
- + * The non-active time is the remainder: (DM_TIMER_MAX-match_value)
- + * clock cycles.
- + *
- + * NOTE: It is required that: load_value <= match_value < DM_TIMER_MAX
- + *
- + * References:
- + * OMAP4430/60/70 TRM sections 22.2.4.10 and 22.2.4.11
- + * AM335x Sitara TRM sections 20.1.3.5 and 20.1.3.6
- + */
- + period_cycles = pwm_omap_dmtimer_get_clock_cycles(clk_rate, period_ns);
- + duty_cycles = pwm_omap_dmtimer_get_clock_cycles(clk_rate, duty_ns);
- +
- + if (period_cycles < 2) {
- + dev_info(chip->dev,
- + "period %d ns too short for clock rate %lu Hz\n",
- + period_ns, clk_rate);
- + goto err_einval;
- + }
- +
- + if (duty_cycles < 1) {
- + dev_dbg(chip->dev,
- + "duty cycle %d ns is too short for clock rate %lu Hz\n",
- + duty_ns, clk_rate);
- + dev_dbg(chip->dev, "using minimum of 1 clock cycle\n");
- + duty_cycles = 1;
- + } else if (duty_cycles >= period_cycles) {
- + dev_dbg(chip->dev,
- + "duty cycle %d ns is too long for period %d ns at clock rate %lu Hz\n",
- + duty_ns, period_ns, clk_rate);
- + dev_dbg(chip->dev, "using maximum of 1 clock cycle less than period\n");
- + duty_cycles = period_cycles - 1;
- + }
- +
- + dev_dbg(chip->dev, "effective duty cycle: %lld ns, period: %lld ns\n",
- + DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * duty_cycles,
- + clk_rate),
- + DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * period_cycles,
- + clk_rate));
- +
- + load_value = (DM_TIMER_MAX - period_cycles) + 1;
- + match_value = load_value + duty_cycles - 1;
- +
- + /*
- + * We MUST stop the associated dual-mode timer before attempting to
- + * write its registers, but calls to omap_dm_timer_start/stop must
- + * be balanced so check if timer is active before calling timer_stop.
- + */
- + timer_active = pm_runtime_active(&omap->dm_timer_pdev->dev);
- + if (timer_active)
- + omap->pdata->stop(omap->dm_timer);
- +
- + omap->pdata->set_load(omap->dm_timer, true, load_value);
- + omap->pdata->set_match(omap->dm_timer, true, match_value);
- +
- + dev_dbg(chip->dev, "load value: %#08x (%d), match value: %#08x (%d)\n",
- + load_value, load_value, match_value, match_value);
- +
- + omap->pdata->set_pwm(omap->dm_timer,
- + pwm->polarity == PWM_POLARITY_INVERSED,
- + true,
- + PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW_AND_COMPARE);
- +
- + /* If config was called while timer was running it must be reenabled. */
- + if (timer_active)
- + pwm_omap_dmtimer_start(omap);
- +
- + mutex_unlock(&omap->mutex);
- +
- + return 0;
- +
- +err_einval:
- + mutex_unlock(&omap->mutex);
- +
- + return -EINVAL;
- +}
- +
- +static int pwm_omap_dmtimer_set_polarity(struct pwm_chip *chip,
- + struct pwm_device *pwm,
- + enum pwm_polarity polarity)
- +{
- + struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
- +
- + /*
- + * PWM core will not call set_polarity while PWM is enabled so it's
- + * safe to reconfigure the timer here without stopping it first.
- + */
- + mutex_lock(&omap->mutex);
- + omap->pdata->set_pwm(omap->dm_timer,
- + polarity == PWM_POLARITY_INVERSED,
- + true,
- + PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW_AND_COMPARE);
- + mutex_unlock(&omap->mutex);
- +
- + return 0;
- +}
- +
- +static const struct pwm_ops pwm_omap_dmtimer_ops = {
- + .enable = pwm_omap_dmtimer_enable,
- + .disable = pwm_omap_dmtimer_disable,
- + .config = pwm_omap_dmtimer_config,
- + .set_polarity = pwm_omap_dmtimer_set_polarity,
- + .owner = THIS_MODULE,
- +};
- +
- +static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
- +{
- + struct device_node *np = pdev->dev.of_node;
- + struct device_node *timer;
- + struct pwm_omap_dmtimer_chip *omap;
- + struct pwm_omap_dmtimer_pdata *pdata;
- + pwm_omap_dmtimer *dm_timer;
- + u32 prescaler;
- + int status;
- +
- + pdata = dev_get_platdata(&pdev->dev);
- + if (!pdata) {
- + dev_err(&pdev->dev, "Missing dmtimer platform data\n");
- + return -EINVAL;
- + }
- +
- + if (!pdata->request_by_node ||
- + !pdata->free ||
- + !pdata->enable ||
- + !pdata->disable ||
- + !pdata->get_fclk ||
- + !pdata->start ||
- + !pdata->stop ||
- + !pdata->set_load ||
- + !pdata->set_match ||
- + !pdata->set_pwm ||
- + !pdata->set_prescaler ||
- + !pdata->write_counter) {
- + dev_err(&pdev->dev, "Incomplete dmtimer pdata structure\n");
- + return -EINVAL;
- + }
- +
- + timer = of_parse_phandle(np, "ti,timers", 0);
- + if (!timer)
- + return -ENODEV;
- +
- + if (!of_get_property(timer, "ti,timer-pwm", NULL)) {
- + dev_err(&pdev->dev, "Missing ti,timer-pwm capability\n");
- + return -ENODEV;
- + }
- +
- + dm_timer = pdata->request_by_node(timer);
- + if (!dm_timer)
- + return -EPROBE_DEFER;
- +
- + omap = devm_kzalloc(&pdev->dev, sizeof(*omap), GFP_KERNEL);
- + if (!omap) {
- + pdata->free(dm_timer);
- + return -ENOMEM;
- + }
- +
- + omap->pdata = pdata;
- + omap->dm_timer = dm_timer;
- +
- + omap->dm_timer_pdev = of_find_device_by_node(timer);
- + if (!omap->dm_timer_pdev) {
- + dev_err(&pdev->dev, "Unable to find timer pdev\n");
- + omap->pdata->free(dm_timer);
- + return -EINVAL;
- + }
- +
- + /*
- + * Ensure that the timer is stopped before we allow PWM core to call
- + * pwm_enable.
- + */
- + if (pm_runtime_active(&omap->dm_timer_pdev->dev))
- + omap->pdata->stop(omap->dm_timer);
- +
- + /* setup dmtimer prescaler */
- + if (!of_property_read_u32(pdev->dev.of_node, "ti,prescaler",
- + &prescaler))
- + omap->pdata->set_prescaler(omap->dm_timer, prescaler);
- +
- + omap->chip.dev = &pdev->dev;
- + omap->chip.ops = &pwm_omap_dmtimer_ops;
- + omap->chip.base = -1;
- + omap->chip.npwm = 1;
- + omap->chip.of_xlate = of_pwm_xlate_with_flags;
- + omap->chip.of_pwm_n_cells = 3;
- +
- + mutex_init(&omap->mutex);
- +
- + status = pwmchip_add(&omap->chip);
- + if (status < 0) {
- + dev_err(&pdev->dev, "failed to register PWM\n");
- + omap->pdata->free(omap->dm_timer);
- + return status;
- + }
- +
- + platform_set_drvdata(pdev, omap);
- +
- + return 0;
- +}
- +
- +static int pwm_omap_dmtimer_remove(struct platform_device *pdev)
- +{
- + struct pwm_omap_dmtimer_chip *omap = platform_get_drvdata(pdev);
- +
- + if (pm_runtime_active(&omap->dm_timer_pdev->dev))
- + omap->pdata->stop(omap->dm_timer);
- +
- + omap->pdata->free(omap->dm_timer);
- +
- + mutex_destroy(&omap->mutex);
- +
- + return pwmchip_remove(&omap->chip);
- +}
- +
- +static const struct of_device_id pwm_omap_dmtimer_of_match[] = {
- + {.compatible = "ti,omap-dmtimer-pwm"},
- + {}
- +};
- +MODULE_DEVICE_TABLE(of, pwm_omap_dmtimer_of_match);
- +
- +static struct platform_driver pwm_omap_dmtimer_driver = {
- + .driver = {
- + .name = "omap-dmtimer-pwm",
- + .of_match_table = of_match_ptr(pwm_omap_dmtimer_of_match),
- + },
- + .probe = pwm_omap_dmtimer_probe,
- + .remove = pwm_omap_dmtimer_remove,
- +};
- +module_platform_driver(pwm_omap_dmtimer_driver);
- +
- +MODULE_AUTHOR("Grant Erickson <marathon96@gmail.com>");
- +MODULE_AUTHOR("NeilBrown <neilb@suse.de>");
- +MODULE_AUTHOR("Neil Armstrong <narmstrong@baylibre.com>");
- +MODULE_LICENSE("GPL v2");
- +MODULE_DESCRIPTION("OMAP PWM Driver using Dual-mode Timers");
- diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
- index f7be348..ba47c88 100644
- --- a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
- +++ b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c
- @@ -11,6 +11,7 @@
- #include <linux/gpio.h>
- #include <linux/module.h>
- +#include <linux/delay.h>
- #include <linux/platform_device.h>
- #include <linux/slab.h>
- #include <linux/of.h>
- @@ -79,6 +80,8 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
- in->ops.dpi->set_data_lines(in, ddata->data_lines);
- in->ops.dpi->set_timings(in, &ddata->videomode);
- + msleep(300);
- +
- r = in->ops.dpi->enable(in);
- if (r)
- return r;
- @@ -86,6 +89,8 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
- if (ddata->enable_gpio)
- gpiod_set_value_cansleep(ddata->enable_gpio, 1);
- + msleep(300);
- +
- if (gpio_is_valid(ddata->backlight_gpio))
- gpio_set_value_cansleep(ddata->backlight_gpio, 1);
- diff --git a/include/linux/platform_data/pwm_omap_dmtimer.h b/include/linux/platform_data/pwm_omap_dmtimer.h
- new file mode 100644
- index 0000000..5938421
- --- /dev/null
- +++ b/include/linux/platform_data/pwm_omap_dmtimer.h
- @@ -0,0 +1,69 @@
- +/*
- + * include/linux/platform_data/pwm_omap_dmtimer.h
- + *
- + * OMAP Dual-Mode Timer PWM platform data
- + *
- + * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- + * Tarun Kanti DebBarma <tarun.kanti@ti.com>
- + * Thara Gopinath <thara@ti.com>
- + *
- + * Platform device conversion and hwmod support.
- + *
- + * Copyright (C) 2005 Nokia Corporation
- + * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com>
- + * PWM and clock framework support by Timo Teras.
- + *
- + * This program is free software; you can redistribute it and/or modify it
- + * under the terms of the GNU General Public License as published by the
- + * Free Software Foundation; either version 2 of the License, or (at your
- + * option) any later version.
- + *
- + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
- + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- + *
- + * You should have received a copy of the GNU General Public License along
- + * with this program; if not, write to the Free Software Foundation, Inc.,
- + * 675 Mass Ave, Cambridge, MA 02139, USA.
- + */
- +
- +#ifndef __PWM_OMAP_DMTIMER_PDATA_H
- +#define __PWM_OMAP_DMTIMER_PDATA_H
- +
- +/* trigger types */
- +#define PWM_OMAP_DMTIMER_TRIGGER_NONE 0x00
- +#define PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW 0x01
- +#define PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW_AND_COMPARE 0x02
- +
- +struct omap_dm_timer;
- +typedef struct omap_dm_timer pwm_omap_dmtimer;
- +
- +struct pwm_omap_dmtimer_pdata {
- + pwm_omap_dmtimer *(*request_by_node)(struct device_node *np);
- + int (*free)(pwm_omap_dmtimer *timer);
- +
- + void (*enable)(pwm_omap_dmtimer *timer);
- + void (*disable)(pwm_omap_dmtimer *timer);
- +
- + struct clk *(*get_fclk)(pwm_omap_dmtimer *timer);
- +
- + int (*start)(pwm_omap_dmtimer *timer);
- + int (*stop)(pwm_omap_dmtimer *timer);
- +
- + int (*set_load)(pwm_omap_dmtimer *timer, int autoreload,
- + unsigned int value);
- + int (*set_match)(pwm_omap_dmtimer *timer, int enable,
- + unsigned int match);
- + int (*set_pwm)(pwm_omap_dmtimer *timer, int def_on,
- + int toggle, int trigger);
- + int (*set_prescaler)(pwm_omap_dmtimer *timer, int prescaler);
- +
- + int (*write_counter)(pwm_omap_dmtimer *timer, unsigned int value);
- +};
- +
- +#endif /* __PWM_OMAP_DMTIMER_PDATA_H */
- --
- 2.7.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement