diff options
| -rw-r--r-- | Documentation/devicetree/bindings/mfd/atmel-matrix.txt | 24 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/mfd/atmel-smc.txt | 19 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/usb/atmel-usb.txt | 10 | ||||
| -rw-r--r-- | drivers/usb/gadget/udc/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/usb/gadget/udc/at91_udc.c | 525 | ||||
| -rw-r--r-- | drivers/usb/gadget/udc/at91_udc.h | 9 | ||||
| -rw-r--r-- | include/linux/mfd/syscon/atmel-matrix.h | 117 | ||||
| -rw-r--r-- | include/linux/mfd/syscon/atmel-smc.h | 173 |
8 files changed, 623 insertions, 255 deletions
diff --git a/Documentation/devicetree/bindings/mfd/atmel-matrix.txt b/Documentation/devicetree/bindings/mfd/atmel-matrix.txt new file mode 100644 index 000000000000..e3ef50ca02a5 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/atmel-matrix.txt | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | * Device tree bindings for Atmel Bus Matrix | ||
| 2 | |||
| 3 | The Bus Matrix registers are used to configure Atmel SoCs internal bus | ||
| 4 | behavior (master/slave priorities, undefined burst length type, ...) | ||
| 5 | |||
| 6 | Required properties: | ||
| 7 | - compatible: Should be one of the following | ||
| 8 | "atmel,at91sam9260-matrix", "syscon" | ||
| 9 | "atmel,at91sam9261-matrix", "syscon" | ||
| 10 | "atmel,at91sam9263-matrix", "syscon" | ||
| 11 | "atmel,at91sam9rl-matrix", "syscon" | ||
| 12 | "atmel,at91sam9g45-matrix", "syscon" | ||
| 13 | "atmel,at91sam9n12-matrix", "syscon" | ||
| 14 | "atmel,at91sam9x5-matrix", "syscon" | ||
| 15 | "atmel,sama5d3-matrix", "syscon" | ||
| 16 | - reg: Contains offset/length value of the Bus Matrix | ||
| 17 | memory region. | ||
| 18 | |||
| 19 | Example: | ||
| 20 | |||
| 21 | matrix: matrix@ffffec00 { | ||
| 22 | compatible = "atmel,sama5d3-matrix", "syscon"; | ||
| 23 | reg = <0xffffec00 0x200>; | ||
| 24 | }; | ||
diff --git a/Documentation/devicetree/bindings/mfd/atmel-smc.txt b/Documentation/devicetree/bindings/mfd/atmel-smc.txt new file mode 100644 index 000000000000..26eeed373934 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/atmel-smc.txt | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | * Device tree bindings for Atmel SMC (Static Memory Controller) | ||
| 2 | |||
| 3 | The SMC registers are used to configure Atmel EBI (External Bus Interface) | ||
| 4 | to interface with standard memory devices (NAND, NOR, SRAM or specialized | ||
| 5 | devices like FPGAs). | ||
| 6 | |||
| 7 | Required properties: | ||
| 8 | - compatible: Should be one of the following | ||
| 9 | "atmel,at91sam9260-smc", "syscon" | ||
| 10 | "atmel,sama5d3-smc", "syscon" | ||
| 11 | - reg: Contains offset/length value of the SMC memory | ||
| 12 | region. | ||
| 13 | |||
| 14 | Example: | ||
| 15 | |||
| 16 | smc: smc@ffffc000 { | ||
| 17 | compatible = "atmel,sama5d3-smc", "syscon"; | ||
| 18 | reg = <0xffffc000 0x1000>; | ||
| 19 | }; | ||
diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt index bc2222ca3f2a..54a81219caae 100644 --- a/Documentation/devicetree/bindings/usb/atmel-usb.txt +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt | |||
| @@ -33,9 +33,17 @@ usb1: ehci@00800000 { | |||
| 33 | AT91 USB device controller | 33 | AT91 USB device controller |
| 34 | 34 | ||
| 35 | Required properties: | 35 | Required properties: |
| 36 | - compatible: Should be "atmel,at91rm9200-udc" | 36 | - compatible: Should be one of the following |
| 37 | "atmel,at91rm9200-udc" | ||
| 38 | "atmel,at91sam9260-udc" | ||
| 39 | "atmel,at91sam9261-udc" | ||
| 40 | "atmel,at91sam9263-udc" | ||
| 37 | - reg: Address and length of the register set for the device | 41 | - reg: Address and length of the register set for the device |
| 38 | - interrupts: Should contain macb interrupt | 42 | - interrupts: Should contain macb interrupt |
| 43 | - clocks: Should reference the peripheral and the AHB clocks | ||
| 44 | - clock-names: Should contains two strings | ||
| 45 | "pclk" for the peripheral clock | ||
| 46 | "hclk" for the AHB clock | ||
| 39 | 47 | ||
| 40 | Optional properties: | 48 | Optional properties: |
| 41 | - atmel,vbus-gpio: If present, specifies a gpio that needs to be | 49 | - atmel,vbus-gpio: If present, specifies a gpio that needs to be |
diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig index b8e213eb36cc..366e551aeff0 100644 --- a/drivers/usb/gadget/udc/Kconfig +++ b/drivers/usb/gadget/udc/Kconfig | |||
| @@ -32,6 +32,7 @@ menu "USB Peripheral Controller" | |||
| 32 | config USB_AT91 | 32 | config USB_AT91 |
| 33 | tristate "Atmel AT91 USB Device Port" | 33 | tristate "Atmel AT91 USB Device Port" |
| 34 | depends on ARCH_AT91 | 34 | depends on ARCH_AT91 |
| 35 | depends on OF || COMPILE_TEST | ||
| 35 | help | 36 | help |
| 36 | Many Atmel AT91 processors (such as the AT91RM2000) have a | 37 | Many Atmel AT91 processors (such as the AT91RM2000) have a |
| 37 | full speed USB Device Port with support for five configurable | 38 | full speed USB Device Port with support for five configurable |
diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index c862656d18b8..6d285226ab94 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c | |||
| @@ -31,16 +31,9 @@ | |||
| 31 | #include <linux/of.h> | 31 | #include <linux/of.h> |
| 32 | #include <linux/of_gpio.h> | 32 | #include <linux/of_gpio.h> |
| 33 | #include <linux/platform_data/atmel.h> | 33 | #include <linux/platform_data/atmel.h> |
| 34 | 34 | #include <linux/regmap.h> | |
| 35 | #include <asm/byteorder.h> | 35 | #include <linux/mfd/syscon.h> |
| 36 | #include <mach/hardware.h> | 36 | #include <linux/mfd/syscon/atmel-matrix.h> |
| 37 | #include <asm/io.h> | ||
| 38 | #include <asm/irq.h> | ||
| 39 | #include <asm/gpio.h> | ||
| 40 | |||
| 41 | #include <mach/cpu.h> | ||
| 42 | #include <mach/at91sam9261_matrix.h> | ||
| 43 | #include <mach/at91_matrix.h> | ||
| 44 | 37 | ||
| 45 | #include "at91_udc.h" | 38 | #include "at91_udc.h" |
| 46 | 39 | ||
| @@ -66,7 +59,15 @@ | |||
| 66 | #define DRIVER_VERSION "3 May 2006" | 59 | #define DRIVER_VERSION "3 May 2006" |
| 67 | 60 | ||
| 68 | static const char driver_name [] = "at91_udc"; | 61 | static const char driver_name [] = "at91_udc"; |
| 69 | static const char ep0name[] = "ep0"; | 62 | static const char * const ep_names[] = { |
| 63 | "ep0", | ||
| 64 | "ep1", | ||
| 65 | "ep2", | ||
| 66 | "ep3-int", | ||
| 67 | "ep4", | ||
| 68 | "ep5", | ||
| 69 | }; | ||
| 70 | #define ep0name ep_names[0] | ||
| 70 | 71 | ||
| 71 | #define VBUS_POLL_TIMEOUT msecs_to_jiffies(1000) | 72 | #define VBUS_POLL_TIMEOUT msecs_to_jiffies(1000) |
| 72 | 73 | ||
| @@ -895,8 +896,6 @@ static void clk_on(struct at91_udc *udc) | |||
| 895 | return; | 896 | return; |
| 896 | udc->clocked = 1; | 897 | udc->clocked = 1; |
| 897 | 898 | ||
| 898 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
| 899 | clk_enable(udc->uclk); | ||
| 900 | clk_enable(udc->iclk); | 899 | clk_enable(udc->iclk); |
| 901 | clk_enable(udc->fclk); | 900 | clk_enable(udc->fclk); |
| 902 | } | 901 | } |
| @@ -909,8 +908,6 @@ static void clk_off(struct at91_udc *udc) | |||
| 909 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 908 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
| 910 | clk_disable(udc->fclk); | 909 | clk_disable(udc->fclk); |
| 911 | clk_disable(udc->iclk); | 910 | clk_disable(udc->iclk); |
| 912 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
| 913 | clk_disable(udc->uclk); | ||
| 914 | } | 911 | } |
| 915 | 912 | ||
| 916 | /* | 913 | /* |
| @@ -919,8 +916,6 @@ static void clk_off(struct at91_udc *udc) | |||
| 919 | */ | 916 | */ |
| 920 | static void pullup(struct at91_udc *udc, int is_on) | 917 | static void pullup(struct at91_udc *udc, int is_on) |
| 921 | { | 918 | { |
| 922 | int active = !udc->board.pullup_active_low; | ||
| 923 | |||
| 924 | if (!udc->enabled || !udc->vbus) | 919 | if (!udc->enabled || !udc->vbus) |
| 925 | is_on = 0; | 920 | is_on = 0; |
| 926 | DBG("%sactive\n", is_on ? "" : "in"); | 921 | DBG("%sactive\n", is_on ? "" : "in"); |
| @@ -929,40 +924,15 @@ static void pullup(struct at91_udc *udc, int is_on) | |||
| 929 | clk_on(udc); | 924 | clk_on(udc); |
| 930 | at91_udp_write(udc, AT91_UDP_ICR, AT91_UDP_RXRSM); | 925 | at91_udp_write(udc, AT91_UDP_ICR, AT91_UDP_RXRSM); |
| 931 | at91_udp_write(udc, AT91_UDP_TXVC, 0); | 926 | at91_udp_write(udc, AT91_UDP_TXVC, 0); |
| 932 | if (cpu_is_at91rm9200()) | ||
| 933 | gpio_set_value(udc->board.pullup_pin, active); | ||
| 934 | else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || cpu_is_at91sam9g20()) { | ||
| 935 | u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC); | ||
| 936 | |||
| 937 | txvc |= AT91_UDP_TXVC_PUON; | ||
| 938 | at91_udp_write(udc, AT91_UDP_TXVC, txvc); | ||
| 939 | } else if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()) { | ||
| 940 | u32 usbpucr; | ||
| 941 | |||
| 942 | usbpucr = at91_matrix_read(AT91_MATRIX_USBPUCR); | ||
| 943 | usbpucr |= AT91_MATRIX_USBPUCR_PUON; | ||
| 944 | at91_matrix_write(AT91_MATRIX_USBPUCR, usbpucr); | ||
| 945 | } | ||
