arm: atmel: get rid of too many ifdeffery
authorBo Shen <voice.shen@atmel.com>
Mon, 21 Oct 2013 08:14:00 +0000 (16:14 +0800)
committerAndreas Bießmann <andreas.devel@googlemail.com>
Mon, 4 Nov 2013 19:32:37 +0000 (20:32 +0100)
Get rid of too many ifdeffery in usb ohci driver

Add following two configuration for USB clock selecting
- CONFIG_USB_ATMEL_CLK_SEL_PLLB: using PLLB as usb ohci input clock
- CONFIG_USB_ATMEL_CLK_SEL_UPLL: using UPLL as usb ohci input clock

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
23 files changed:
drivers/usb/host/ohci-at91.c
include/configs/afeb9260.h
include/configs/at91rm9200ek.h
include/configs/at91sam9260ek.h
include/configs/at91sam9261ek.h
include/configs/at91sam9263ek.h
include/configs/at91sam9n12ek.h
include/configs/at91sam9x5ek.h
include/configs/cpu9260.h
include/configs/cpuat91.h
include/configs/eb_cpux9k2.h
include/configs/ethernut5.h
include/configs/meesc.h
include/configs/otc570.h
include/configs/pm9261.h
include/configs/pm9263.h
include/configs/pm9g45.h
include/configs/sama5d3xek.h
include/configs/sbc35_a9g20.h
include/configs/snapper9260.h
include/configs/stamp9g20.h
include/configs/top9000.h
include/configs/vl_ma2sc.h

index 05d6ff2b69e8b1fc91a5670953a6a6ca0f990b0e..c24505e78eaa29eb60ab63c14b671b0d60bb5cd9 100644 (file)
@@ -18,9 +18,7 @@ int usb_cpu_init(void)
 {
        at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
 
-#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) || \
-       defined(CONFIG_AT91SAM9261) || defined(CONFIG_AT91SAM9N12)
+#ifdef CONFIG_USB_ATMEL_CLK_SEL_PLLB
        /* Enable PLLB */
        writel(get_pllb_init(), &pmc->pllbr);
        while ((readl(&pmc->sr) & AT91_PMC_LOCKB) != AT91_PMC_LOCKB)
@@ -28,8 +26,7 @@ int usb_cpu_init(void)
 #ifdef CONFIG_AT91SAM9N12
        writel(AT91_PMC_USBS_USB_PLLB | AT91_PMC_USB_DIV_2, &pmc->usb);
 #endif
-#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \
-       defined(CONFIG_AT91SAM9X5) || defined(CONFIG_SAMA5D3)
+#elif defined(CONFIG_USB_ATMEL_CLK_SEL_UPLL)
        /* Enable UPLL */
        writel(readl(&pmc->uckr) | AT91_PMC_UPLLEN | AT91_PMC_BIASEN,
                &pmc->uckr);
@@ -73,9 +70,7 @@ int usb_cpu_stop(void)
        writel(ATMEL_PMC_UHP, &pmc->scdr);
 #endif
 
-#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-       defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) || \
-       defined(CONFIG_AT91SAM9N12)
+#ifdef CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #ifdef CONFIG_AT91SAM9N12
        writel(0, &pmc->usb);
 #endif
@@ -83,8 +78,7 @@ int usb_cpu_stop(void)
        writel(0, &pmc->pllbr);
        while ((readl(&pmc->sr) & AT91_PMC_LOCKB) != 0)
                ;
-#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \
-       defined(CONFIG_AT91SAM9X5) || defined(CONFIG_SAMA5D3)
+#elif defined(CONFIG_USB_ATMEL_CLK_SEL_UPLL)
        /* Disable UPLL */
        writel(readl(&pmc->uckr) & (~AT91_PMC_UPLLEN), &pmc->uckr);
        while ((readl(&pmc->sr) & AT91_PMC_LOCKU) == AT91_PMC_LOCKU)
index be2f20705583a5bd9d2d15d840de4a6666b045a5..d99d6719ae87af9265d6b017212a3f3b3462208a 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_DOS_PARTITION
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
index e158b0dd2df4bcd361f1eb75314ecb6eb4819e08..27e32e24e3ff3db323bc272f7657cdd8a4c53e73 100644 (file)
  * USB Config
  */
 #define CONFIG_USB_ATMEL                       1
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW                    1
 #define CONFIG_USB_KEYBOARD                    1
 #define CONFIG_USB_STORAGE                     1
index d7fd6b089c1d1bc4a93ba2f750f91daa8e094855..248d6ee73cdd845efba07d9546ed95b6b6619c76 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW            1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT           1
 #define CONFIG_SYS_USB_OHCI_REGS_BASE          0x00500000      /* AT91SAM9260_UHP_BASE */
index af56604396c9e90db1de79e3d155adba967e5612..819ae72bcdb0f53b0fec58119bb3b2144e220bfe 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_DOS_PARTITION
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
index 40e167c10a6da155582206cef516cf2a33f60854..e3faec729de949e35bbd57951f2a6e5641d96b3d 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW            1
 #define CONFIG_DOS_PARTITION           1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT           1
index cc79f8b06abb01c1dd5320b6dd01a721f311de5c..4cdaed178bb1afaae7503d745c5e59e6a6dd2fc9 100644 (file)
 /* USB host */
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
 #define CONFIG_SYS_USB_OHCI_REGS_BASE  ATMEL_BASE_OHCI
index 4a2ac9aabde12354b353c32ade3f31eea6086d5a..cb57be0b5d920572773f9504d7c3e212b2fb0d83 100644 (file)
 #define CONFIG_USB_EHCI_ATMEL
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS     2
 #else
+#define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_UPLL
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
 #define CONFIG_SYS_USB_OHCI_REGS_BASE          ATMEL_BASE_OHCI
 #define CONFIG_SYS_USB_OHCI_SLOT_NAME          "at91sam9x5"
 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS     3
 #endif
-#define CONFIG_USB_ATMEL
 #define CONFIG_USB_STORAGE
 #endif
 
index 5b79ace5fa0599e4617b06abce9245de375d3e20..796dfc39a595cc6226dc5c5b3c0976d6b0ed1964 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_DOS_PARTITION
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
index 6742dbcd9215ccd9ba4d21dc7dc314967298a244..67732de3a89a307889d2cd5d51525dbbdc326a51 100644 (file)
 
 #if defined(CONFIG_CMD_USB)
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_USB_STORAGE
 #define CONFIG_DOS_PARTITION
index b8e672f82bf5bd4311e284f54378cb3c76db90b6..9d40798e43e46331153aed2b1645067e456d886d 100644 (file)
  * Hardware drivers
  */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_AT91C_PQFP_UHPBUG
 #define CONFIG_USB_STORAGE
index adf14be3658d0de612370aa2503e72bdc5fd14c9..7fd0b51860fd690a662121ef3656eacea5b677bd 100644 (file)
 /* USB */
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
 #define CONFIG_SYS_USB_OHCI_REGS_BASE  0x00500000
index d2ec83cd1f42b14e7b1863d941552ede5fd510e4..46a8e012c8e3bd5534f985f5aadac54efc58f062 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_DOS_PARTITION
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
index 543209cb9d79e53935003e80659c0461abb548a1..d5eba587e443c9314a938c1b6d878d1fc88e9880 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_DOS_PARTITION
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
index 67b40b2fcc708e9d7dff517e96e6da5eb959fbc5..792f4cd41849406e3f0312db90c09d6356243638 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW                    1
 #define CONFIG_DOS_PARTITION                   1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT           1
index 2b4335e78e90a33a4c722647cf791964086748fc..ff379a54b0f655726ea429e404b1b69c32436646 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW                    1
 #define CONFIG_DOS_PARTITION                   1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT           1
index 7d16bd8b2502e51a133d6a36d297a1125f6b30c9..f15ae6dd7fe814b62608d118f6ffa7f013e37621 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_UPLL
 #define CONFIG_USB_OHCI_NEW            1
 #define CONFIG_DOS_PARTITION           1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT   1
index 79c00684dd262d59a22cf1e0ed852035e15f79d9..924d7fabac34c39497e7b04cc62ddb5ac91c9894 100644 (file)
 
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_UPLL
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
 #define CONFIG_SYS_USB_OHCI_REGS_BASE          ATMEL_BASE_OHCI
index 4ba224252afc76a1ce8a346a7e73818160f22a8b..3cf693bdc9ed2b49b6807e0a16742fcc4bcf86c8 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_DOS_PARTITION
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
index 17eb5f24552b1ac1652a3828f1c7a9d96b8edeae..c5de89e1f806e2b0d3d610116d4ec599594e7b53 100644 (file)
@@ -65,6 +65,7 @@
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_DOS_PARTITION
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
index a9973315c20511ef799e31e27b427884913b6595..95fc26ba9b220eacde6bc4adb94cd21d65d5914d 100644 (file)
 
 /* USB configuration */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_USB_STORAGE
 #define CONFIG_DOS_PARTITION
index a6d692872cecbd6551b10d2ab30b13fc6bb69844..159a8bca1081aa347aa0ee462f38a9be010d42d1 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_DOS_PARTITION
 #define CONFIG_SYS_USB_OHCI_CPU_INIT
index e171ae4c404b51db9bf16c8d5393da15f07c47f7..f5d856493cb05d5ef836646fd08bcf18c1b5cf44 100644 (file)
 
 /* USB */
 #define CONFIG_USB_ATMEL
+#define CONFIG_USB_ATMEL_CLK_SEL_PLLB
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_DOS_PARTITION
 #define CONFIG_SYS_USB_OHCI_CPU_INIT