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

ARM: cns3xxx: Add architecture definition for EHCI/OHCI controller

This patch add plateform_device for EHCI and OHCI controller on CNS3XXX.
Power reference count (usb_pwr_ref) is used to control enabling and
disabling the single clock control for both EHCI and OHCI controller.

It also removes EHCI/OHCI unused virtual address definitions.

Signed-off-by: Mac Lin <mkl0301@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>

authored by

Mac Lin and committed by
Anton Vorontsov
cf36797f 38e64ba0

+62 -2
+54
arch/arm/mach-cns3xxx/cns3420vb.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/compiler.h> 19 19 #include <linux/io.h> 20 + #include <linux/dma-mapping.h> 20 21 #include <linux/serial_core.h> 21 22 #include <linux/serial_8250.h> 22 23 #include <linux/platform_device.h> ··· 109 108 } 110 109 111 110 /* 111 + * USB 112 + */ 113 + static struct resource cns3xxx_usb_ehci_resources[] = { 114 + [0] = { 115 + .start = CNS3XXX_USB_BASE, 116 + .end = CNS3XXX_USB_BASE + SZ_16M - 1, 117 + .flags = IORESOURCE_MEM, 118 + }, 119 + [1] = { 120 + .start = IRQ_CNS3XXX_USB_EHCI, 121 + .flags = IORESOURCE_IRQ, 122 + }, 123 + }; 124 + 125 + static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32); 126 + 127 + static struct platform_device cns3xxx_usb_ehci_device = { 128 + .name = "cns3xxx-ehci", 129 + .num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources), 130 + .resource = cns3xxx_usb_ehci_resources, 131 + .dev = { 132 + .dma_mask = &cns3xxx_usb_ehci_dma_mask, 133 + .coherent_dma_mask = DMA_BIT_MASK(32), 134 + }, 135 + }; 136 + 137 + static struct resource cns3xxx_usb_ohci_resources[] = { 138 + [0] = { 139 + .start = CNS3XXX_USB_OHCI_BASE, 140 + .end = CNS3XXX_USB_OHCI_BASE + SZ_16M - 1, 141 + .flags = IORESOURCE_MEM, 142 + }, 143 + [1] = { 144 + .start = IRQ_CNS3XXX_USB_OHCI, 145 + .flags = IORESOURCE_IRQ, 146 + }, 147 + }; 148 + 149 + static u64 cns3xxx_usb_ohci_dma_mask = DMA_BIT_MASK(32); 150 + 151 + static struct platform_device cns3xxx_usb_ohci_device = { 152 + .name = "cns3xxx-ohci", 153 + .num_resources = ARRAY_SIZE(cns3xxx_usb_ohci_resources), 154 + .resource = cns3xxx_usb_ohci_resources, 155 + .dev = { 156 + .dma_mask = &cns3xxx_usb_ohci_dma_mask, 157 + .coherent_dma_mask = DMA_BIT_MASK(32), 158 + }, 159 + }; 160 + 161 + /* 112 162 * Initialization 113 163 */ 114 164 static struct platform_device *cns3420_pdevs[] __initdata = { 115 165 &cns3420_nor_pdev, 166 + &cns3xxx_usb_ehci_device, 167 + &cns3xxx_usb_ohci_device, 116 168 }; 117 169 118 170 static void __init cns3420_init(void)
-2
arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
··· 165 165 #define CNS3XXX_USBOTG_BASE_VIRT 0xFFF15000 166 166 167 167 #define CNS3XXX_USB_BASE 0x82000000 /* USB Host Control */ 168 - #define CNS3XXX_USB_BASE_VIRT 0xFFF16000 169 168 170 169 #define CNS3XXX_SATA2_BASE 0x83000000 /* SATA */ 171 170 #define CNS3XXX_SATA2_SIZE SZ_16M ··· 183 184 #define CNS3XXX_2DG_BASE_VIRT 0xFFF1B000 184 185 185 186 #define CNS3XXX_USB_OHCI_BASE 0x88000000 /* USB OHCI */ 186 - #define CNS3XXX_USB_OHCI_BASE_VIRT 0xFFF1C000 187 187 188 188 #define CNS3XXX_L2C_BASE 0x92000000 /* L2 Cache Control */ 189 189 #define CNS3XXX_L2C_BASE_VIRT 0xFFF27000
+4
arch/arm/mach-cns3xxx/include/mach/pm.h
··· 11 11 #ifndef __CNS3XXX_PM_H 12 12 #define __CNS3XXX_PM_H 13 13 14 + #include <asm/atomic.h> 15 + 14 16 void cns3xxx_pwr_clk_en(unsigned int block); 15 17 void cns3xxx_pwr_clk_dis(unsigned int block); 16 18 void cns3xxx_pwr_power_up(unsigned int block); 17 19 void cns3xxx_pwr_power_down(unsigned int block); 20 + 21 + extern atomic_t usb_pwr_ref; 18 22 19 23 #endif /* __CNS3XXX_PM_H */
+4
arch/arm/mach-cns3xxx/pm.c
··· 10 10 #include <linux/module.h> 11 11 #include <linux/io.h> 12 12 #include <linux/delay.h> 13 + #include <asm/atomic.h> 13 14 #include <mach/system.h> 14 15 #include <mach/cns3xxx.h> 15 16 #include <mach/pm.h> ··· 119 118 return cpu; 120 119 } 121 120 EXPORT_SYMBOL(cns3xxx_cpu_clock); 121 + 122 + atomic_t usb_pwr_ref = ATOMIC_INIT(0); 123 + EXPORT_SYMBOL(usb_pwr_ref);