diff options
| -rw-r--r-- | arch/arm/mach-davinci/Kconfig | 19 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/aemif.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/board-da850-evm.c | 339 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/clock.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/da850.c | 75 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/devices-tnetv107x.c | 15 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/include/mach/da8xx.h | 7 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/psc.c | 13 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/time.c | 24 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/tnetv107x.c | 23 |
10 files changed, 462 insertions, 59 deletions
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig index b77b860b36d7..32f147998cd9 100644 --- a/arch/arm/mach-davinci/Kconfig +++ b/arch/arm/mach-davinci/Kconfig | |||
| @@ -61,6 +61,8 @@ config MACH_DAVINCI_EVM | |||
| 61 | bool "TI DM644x EVM" | 61 | bool "TI DM644x EVM" |
| 62 | default ARCH_DAVINCI_DM644x | 62 | default ARCH_DAVINCI_DM644x |
| 63 | depends on ARCH_DAVINCI_DM644x | 63 | depends on ARCH_DAVINCI_DM644x |
| 64 | select MISC_DEVICES | ||
| 65 | select EEPROM_AT24 | ||
| 64 | help | 66 | help |
| 65 | Configure this option to specify the whether the board used | 67 | Configure this option to specify the whether the board used |
| 66 | for development is a DM644x EVM | 68 | for development is a DM644x EVM |
| @@ -68,6 +70,8 @@ config MACH_DAVINCI_EVM | |||
| 68 | config MACH_SFFSDR | 70 | config MACH_SFFSDR |
| 69 | bool "Lyrtech SFFSDR" | 71 | bool "Lyrtech SFFSDR" |
| 70 | depends on ARCH_DAVINCI_DM644x | 72 | depends on ARCH_DAVINCI_DM644x |
| 73 | select MISC_DEVICES | ||
| 74 | select EEPROM_AT24 | ||
| 71 | help | 75 | help |
| 72 | Say Y here to select the Lyrtech Small Form Factor | 76 | Say Y here to select the Lyrtech Small Form Factor |
| 73 | Software Defined Radio (SFFSDR) board. | 77 | Software Defined Radio (SFFSDR) board. |
| @@ -99,6 +103,8 @@ config MACH_DAVINCI_DM6467_EVM | |||
| 99 | default ARCH_DAVINCI_DM646x | 103 | default ARCH_DAVINCI_DM646x |
| 100 | depends on ARCH_DAVINCI_DM646x | 104 | depends on ARCH_DAVINCI_DM646x |
| 101 | select MACH_DAVINCI_DM6467TEVM | 105 | select MACH_DAVINCI_DM6467TEVM |
| 106 | select MISC_DEVICES | ||
| 107 | select EEPROM_AT24 | ||
| 102 | help | 108 | help |
| 103 | Configure this option to specify the whether the board used | 109 | Configure this option to specify the whether the board used |
| 104 | for development is a DM6467 EVM | 110 | for development is a DM6467 EVM |
| @@ -110,6 +116,8 @@ config MACH_DAVINCI_DM365_EVM | |||
| 110 | bool "TI DM365 EVM" | 116 | bool "TI DM365 EVM" |
| 111 | default ARCH_DAVINCI_DM365 | 117 | default ARCH_DAVINCI_DM365 |
| 112 | depends on ARCH_DAVINCI_DM365 | 118 | depends on ARCH_DAVINCI_DM365 |
| 119 | select MISC_DEVICES | ||
| 120 | select EEPROM_AT24 | ||
| 113 | help | 121 | help |
| 114 | Configure this option to specify whether the board used | 122 | Configure this option to specify whether the board used |
| 115 | for development is a DM365 EVM | 123 | for development is a DM365 EVM |
| @@ -119,6 +127,8 @@ config MACH_DAVINCI_DA830_EVM | |||
| 119 | default ARCH_DAVINCI_DA830 | 127 | default ARCH_DAVINCI_DA830 |
| 120 | depends on ARCH_DAVINCI_DA830 | 128 | depends on ARCH_DAVINCI_DA830 |
| 121 | select GPIO_PCF857X | 129 | select GPIO_PCF857X |
| 130 | select MISC_DEVICES | ||
| 131 | select EEPROM_AT24 | ||
| 122 | help | 132 | help |
| 123 | Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module. | 133 | Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module. |
| 124 | 134 | ||
| @@ -148,7 +158,6 @@ config MACH_DAVINCI_DA850_EVM | |||
| 148 | bool "TI DA850/OMAP-L138/AM18x Reference Platform" | 158 | bool "TI DA850/OMAP-L138/AM18x Reference Platform" |
| 149 | default ARCH_DAVINCI_DA850 | 159 | default ARCH_DAVINCI_DA850 |
| 150 | depends on ARCH_DAVINCI_DA850 | 160 | depends on ARCH_DAVINCI_DA850 |
| 151 | select GPIO_PCA953X | ||
| 152 | help | 161 | help |
| 153 | Say Y here to select the TI DA850/OMAP-L138/AM18x Evaluation Module. | 162 | Say Y here to select the TI DA850/OMAP-L138/AM18x Evaluation Module. |
| 154 | 163 | ||
| @@ -178,6 +187,12 @@ config DA850_UI_RMII | |||
| 178 | 187 | ||
| 179 | endchoice | 188 | endchoice |
| 180 | 189 | ||
| 190 | config GPIO_PCA953X | ||
| 191 | default MACH_DAVINCI_DA850_EVM | ||
| 192 | |||
| 193 | config KEYBOARD_GPIO_POLLED | ||
| 194 | default MACH_DAVINCI_DA850_EVM | ||
| 195 | |||
| 181 | config MACH_TNETV107X | 196 | config MACH_TNETV107X |
| 182 | bool "TI TNETV107X Reference Platform" | 197 | bool "TI TNETV107X Reference Platform" |
| 183 | default ARCH_DAVINCI_TNETV107X | 198 | default ARCH_DAVINCI_TNETV107X |
| @@ -188,6 +203,8 @@ config MACH_TNETV107X | |||
| 188 | config MACH_MITYOMAPL138 | 203 | config MACH_MITYOMAPL138 |
| 189 | bool "Critical Link MityDSP-L138/MityARM-1808 SoM" | 204 | bool "Critical Link MityDSP-L138/MityARM-1808 SoM" |
| 190 | depends on ARCH_DAVINCI_DA850 | 205 | depends on ARCH_DAVINCI_DA850 |
| 206 | select MISC_DEVICES | ||
| 207 | select EEPROM_AT24 | ||
| 191 | help | 208 | help |
| 192 | Say Y here to select the Critical Link MityDSP-L138/MityARM-1808 | 209 | Say Y here to select the Critical Link MityDSP-L138/MityARM-1808 |
| 193 | System on Module. Information on this SoM may be found at | 210 | System on Module. Information on this SoM may be found at |
diff --git a/arch/arm/mach-davinci/aemif.c b/arch/arm/mach-davinci/aemif.c index 9c3f500fc12f..1ce70a91f2e9 100644 --- a/arch/arm/mach-davinci/aemif.c +++ b/arch/arm/mach-davinci/aemif.c | |||
| @@ -90,7 +90,7 @@ int davinci_aemif_setup_timing(struct davinci_aemif_timing *t, | |||
| 90 | void __iomem *base, unsigned cs) | 90 | void __iomem *base, unsigned cs) |
| 91 | { | 91 | { |
| 92 | unsigned set, val; | 92 | unsigned set, val; |
| 93 | unsigned ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup; | 93 | int ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup; |
| 94 | unsigned offset = A1CR_OFFSET + cs * 4; | 94 | unsigned offset = A1CR_OFFSET + cs * 4; |
| 95 | struct clk *aemif_clk; | 95 | struct clk *aemif_clk; |
| 96 | unsigned long clkrate; | 96 | unsigned long clkrate; |
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index c6e11c682e4c..b01fb2ab944a 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c | |||
| @@ -17,8 +17,10 @@ | |||
| 17 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
| 18 | #include <linux/i2c/at24.h> | 18 | #include <linux/i2c/at24.h> |
| 19 | #include <linux/i2c/pca953x.h> | 19 | #include <linux/i2c/pca953x.h> |
| 20 | #include <linux/input.h> | ||
| 20 | #include <linux/mfd/tps6507x.h> | 21 | #include <linux/mfd/tps6507x.h> |
| 21 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
| 23 | #include <linux/gpio_keys.h> | ||
| 22 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
| 23 | #include <linux/mtd/mtd.h> | 25 | #include <linux/mtd/mtd.h> |
| 24 | #include <linux/mtd/nand.h> | 26 | #include <linux/mtd/nand.h> |
| @@ -266,34 +268,115 @@ static inline void da850_evm_setup_emac_rmii(int rmii_sel) | |||
| 266 | struct davinci_soc_info *soc_info = &davinci_soc_info; | 268 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 267 | 269 | ||
| 268 | soc_info->emac_pdata->rmii_en = 1; | 270 | soc_info->emac_pdata->rmii_en = 1; |
| 269 | gpio_set_value(rmii_sel, 0); | 271 | gpio_set_value_cansleep(rmii_sel, 0); |
| 270 | } | 272 | } |
| 271 | #else | 273 | #else |
| 272 | static inline void da850_evm_setup_emac_rmii(int rmii_sel) { } | 274 | static inline void da850_evm_setup_emac_rmii(int rmii_sel) { } |
| 273 | #endif | 275 | #endif |
| 274 | 276 | ||
| 277 | |||
| 278 | #define DA850_KEYS_DEBOUNCE_MS 10 | ||
| 279 | /* | ||
| 280 | * At 200ms polling interval it is possible to miss an | ||
| 281 | * event by tapping very lightly on the push button but most | ||
| 282 | * pushes do result in an event; longer intervals require the | ||
| 283 | * user to hold the button whereas shorter intervals require | ||
| 284 | * more CPU time for polling. | ||
| 285 | */ | ||
| 286 | #define DA850_GPIO_KEYS_POLL_MS 200 | ||
| 287 | |||
| 288 | enum da850_evm_ui_exp_pins { | ||
| 289 | DA850_EVM_UI_EXP_SEL_C = 5, | ||
| 290 | DA850_EVM_UI_EXP_SEL_B, | ||
| 291 | DA850_EVM_UI_EXP_SEL_A, | ||
| 292 | DA850_EVM_UI_EXP_PB8, | ||
| 293 | DA850_EVM_UI_EXP_PB7, | ||
| 294 | DA850_EVM_UI_EXP_PB6, | ||
| 295 | DA850_EVM_UI_EXP_PB5, | ||
| 296 | DA850_EVM_UI_EXP_PB4, | ||
| 297 | DA850_EVM_UI_EXP_PB3, | ||
| 298 | DA850_EVM_UI_EXP_PB2, | ||
| 299 | DA850_EVM_UI_EXP_PB1, | ||
| 300 | }; | ||
| 301 | |||
| 302 | static const char const *da850_evm_ui_exp[] = { | ||
| 303 | [DA850_EVM_UI_EXP_SEL_C] = "sel_c", | ||
| 304 | [DA850_EVM_UI_EXP_SEL_B] = "sel_b", | ||
| 305 | [DA850_EVM_UI_EXP_SEL_A] = "sel_a", | ||
| 306 | [DA850_EVM_UI_EXP_PB8] = "pb8", | ||
| 307 | [DA850_EVM_UI_EXP_PB7] = "pb7", | ||
| 308 | [DA850_EVM_UI_EXP_PB6] = "pb6", | ||
| 309 | [DA850_EVM_UI_EXP_PB5] = "pb5", | ||
| 310 | [DA850_EVM_UI_EXP_PB4] = "pb4", | ||
| 311 | [DA850_EVM_UI_EXP_PB3] = "pb3", | ||
| 312 | [DA850_EVM_UI_EXP_PB2] = "pb2", | ||
| 313 | [DA850_EVM_UI_EXP_PB1] = "pb1", | ||
| 314 | }; | ||
| 315 | |||
| 316 | #define DA850_N_UI_PB 8 | ||
| 317 | |||
| 318 | static struct gpio_keys_button da850_evm_ui_keys[] = { | ||
| 319 | [0 ... DA850_N_UI_PB - 1] = { | ||
| 320 | .type = EV_KEY, | ||
| 321 | .active_low = 1, | ||
| 322 | .wakeup = 0, | ||
| 323 | .debounce_interval = DA850_KEYS_DEBOUNCE_MS, | ||
| 324 | .code = -1, /* assigned at runtime */ | ||
| 325 | .gpio = -1, /* assigned at runtime */ | ||
| 326 | .desc = NULL, /* assigned at runtime */ | ||
| 327 | }, | ||
| 328 | }; | ||
| 329 | |||
| 330 | static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = { | ||
| 331 | .buttons = da850_evm_ui_keys, | ||
| 332 | .nbuttons = ARRAY_SIZE(da850_evm_ui_keys), | ||
| 333 | .poll_interval = DA850_GPIO_KEYS_POLL_MS, | ||
| 334 | }; | ||
| 335 | |||
| 336 | static struct platform_device da850_evm_ui_keys_device = { | ||
| 337 | .name = "gpio-keys-polled", | ||
| 338 | .id = 0, | ||
| 339 | .dev = { | ||
| 340 | .platform_data = &da850_evm_ui_keys_pdata | ||
| 341 | }, | ||
| 342 | }; | ||
| 343 | |||
| 344 | static void da850_evm_ui_keys_init(unsigned gpio) | ||
| 345 | { | ||
| 346 | int i; | ||
| 347 | struct gpio_keys_button *button; | ||
| 348 | |||
| 349 | for (i = 0; i < DA850_N_UI_PB; i++) { | ||
| 350 | button = &da850_evm_ui_keys[i]; | ||
| 351 | button->code = KEY_F8 - i; | ||
| 352 | button->desc = (char *) | ||
| 353 | da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i]; | ||
| 354 | button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i; | ||
| 355 | } | ||
| 356 | } | ||
| 357 | |||
| 275 | static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, | 358 | static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, |
| 276 | unsigned ngpio, void *c) | 359 | unsigned ngpio, void *c) |
| 277 | { | 360 | { |
| 278 | int sel_a, sel_b, sel_c, ret; | 361 | int sel_a, sel_b, sel_c, ret; |
| 279 | 362 | ||
| 280 | sel_a = gpio + 7; | 363 | sel_a = gpio + DA850_EVM_UI_EXP_SEL_A; |
| 281 | sel_b = gpio + 6; | 364 | sel_b = gpio + DA850_EVM_UI_EXP_SEL_B; |
| 282 | sel_c = gpio + 5; | 365 | sel_c = gpio + DA850_EVM_UI_EXP_SEL_C; |
| 283 | 366 | ||
| 284 | ret = gpio_request(sel_a, "sel_a"); | 367 | ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]); |
| 285 | if (ret) { | 368 | if (ret) { |
| 286 | pr_warning("Cannot open UI expander pin %d\n", sel_a); | 369 | pr_warning("Cannot open UI expander pin %d\n", sel_a); |
| 287 | goto exp_setup_sela_fail; | 370 | goto exp_setup_sela_fail; |
| 288 | } | 371 | } |
| 289 | 372 | ||
| 290 | ret = gpio_request(sel_b, "sel_b"); | 373 | ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]); |
| 291 | if (ret) { | 374 | if (ret) { |
| 292 | pr_warning("Cannot open UI expander pin %d\n", sel_b); | 375 | pr_warning("Cannot open UI expander pin %d\n", sel_b); |
| 293 | goto exp_setup_selb_fail; | 376 | goto exp_setup_selb_fail; |
| 294 | } | 377 | } |
| 295 | 378 | ||
| 296 | ret = gpio_request(sel_c, "sel_c"); | 379 | ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]); |
| 297 | if (ret) { | 380 | if (ret) { |
| 298 | pr_warning("Cannot open UI expander pin %d\n", sel_c); | 381 | pr_warning("Cannot open UI expander pin %d\n", sel_c); |
| 299 | goto exp_setup_selc_fail; | 382 | goto exp_setup_selc_fail; |
| @@ -304,6 +387,13 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, | |||
| 304 | gpio_direction_output(sel_b, 1); | 387 | gpio_direction_output(sel_b, 1); |
| 305 | gpio_direction_output(sel_c, 1); | 388 | gpio_direction_output(sel_c, 1); |
| 306 | 389 | ||
| 390 | da850_evm_ui_keys_init(gpio); | ||
| 391 | ret = platform_device_register(&da850_evm_ui_keys_device); | ||
| 392 | if (ret) { | ||
| 393 | pr_warning("Could not register UI GPIO expander push-buttons"); | ||
| 394 | goto exp_setup_keys_fail; | ||
| 395 | } | ||
| 396 | |||
| 307 | ui_card_detected = 1; | 397 | ui_card_detected = 1; |
| 308 | pr_info("DA850/OMAP-L138 EVM UI card detected\n"); | 398 | pr_info("DA850/OMAP-L138 EVM UI card detected\n"); |
| 309 | 399 | ||
| @@ -313,6 +403,8 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, | |||
| 313 | 403 | ||
| 314 | return 0; | 404 | return 0; |
| 315 | 405 | ||
| 406 | exp_setup_keys_fail: | ||
| 407 | gpio_free(sel_c); | ||
| 316 | exp_setup_selc_fail: | 408 | exp_setup_selc_fail: |
| 317 | gpio_free(sel_b); | 409 | gpio_free(sel_b); |
| 318 | exp_setup_selb_fail: | 410 | exp_setup_selb_fail: |
| @@ -324,14 +416,192 @@ exp_setup_sela_fail: | |||
| 324 | static int da850_evm_ui_expander_teardown(struct i2c_client *client, | 416 | static int da850_evm_ui_expander_teardown(struct i2c_client *client, |
| 325 | unsigned gpio, unsigned ngpio, void *c) | 417 | unsigned gpio, unsigned ngpio, void *c) |
| 326 | { | 418 | { |
| 419 | platform_device_unregister(&da850_evm_ui_keys_device); | ||
| 420 | |||
| 327 | /* deselect all functionalities */ | 421 | /* deselect all functionalities */ |
| 328 | gpio_set_value(gpio + 5, 1); | 422 | gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1); |
| 329 | gpio_set_value(gpio + 6, 1); | 423 | gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1); |
| 330 | gpio_set_value(gpio + 7, 1); | 424 | gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1); |
| 425 | |||
| 426 | gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C); | ||
| 427 | gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B); | ||
| 428 | gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A); | ||
| 429 | |||
| 430 | return 0; | ||
| 431 | } | ||
| 432 | |||
| 433 | /* assign the baseboard expander's GPIOs after the UI board's */ | ||
| 434 | #define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp) | ||
| 435 | #define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS) | ||
| 436 | |||
| 437 | enum da850_evm_bb_exp_pins { | ||
| 438 | DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0, | ||
| 439 | DA850_EVM_BB_EXP_SW_RST, | ||
| 440 | DA850_EVM_BB_EXP_TP_23, | ||
| 441 | DA850_EVM_BB_EXP_TP_22, | ||
| 442 | DA850_EVM_BB_EXP_TP_21, | ||
| 443 | DA850_EVM_BB_EXP_USER_PB1, | ||
| 444 | DA850_EVM_BB_EXP_USER_LED2, | ||
| 445 | DA850_EVM_BB_EXP_USER_LED1, | ||
| 446 | DA850_EVM_BB_EXP_USER_SW1, | ||
| 447 | DA850_EVM_BB_EXP_USER_SW2, | ||
| 448 | DA850_EVM_BB_EXP_USER_SW3, | ||
| 449 | DA850_EVM_BB_EXP_USER_SW4, | ||
| 450 | DA850_EVM_BB_EXP_USER_SW5, | ||
| 451 | DA850_EVM_BB_EXP_USER_SW6, | ||
| 452 | DA850_EVM_BB_EXP_USER_SW7, | ||
| 453 | DA850_EVM_BB_EXP_USER_SW8 | ||
| 454 | }; | ||
| 455 | |||
| 456 | static const char const *da850_evm_bb_exp[] = { | ||
| 457 | [DA850_EVM_BB_EXP_DEEP_SLEEP_EN] = "deep_sleep_en", | ||
| 458 | [DA850_EVM_BB_EXP_SW_RST] = "sw_rst", | ||
| 459 | [DA850_EVM_BB_EXP_TP_23] = "tp_23", | ||
| 460 | [DA850_EVM_BB_EXP_TP_22] = "tp_22", | ||
| 461 | [DA850_EVM_BB_EXP_TP_21] = "tp_21", | ||
| 462 | [DA850_EVM_BB_EXP_USER_PB1] = "user_pb1", | ||
| 463 | [DA850_EVM_BB_EXP_USER_LED2] = "user_led2", | ||
| 464 | [DA850_EVM_BB_EXP_USER_LED1] = "user_led1", | ||
| 465 | [DA850_EVM_BB_EXP_USER_SW1] = "user_sw1", | ||
| 466 | [DA850_EVM_BB_EXP_USER_SW2] = "user_sw2", | ||
| 467 | [DA850_EVM_BB_EXP_USER_SW3] = "user_sw3", | ||
| 468 | [DA850_EVM_BB_EXP_USER_SW4] = "user_sw4", | ||
| 469 | [DA850_EVM_BB_EXP_USER_SW5] = "user_sw5", | ||
| 470 | [DA850_EVM_BB_EXP_USER_SW6] = "user_sw6", | ||
| 471 | [DA850_EVM_BB_EXP_USER_SW7] = "user_sw7", | ||
| 472 | [DA850_EVM_BB_EXP_USER_SW8] = "user_sw8", | ||
| 473 | }; | ||
| 474 | |||
| 475 | #define DA850_N_BB_USER_SW 8 | ||
| 476 | |||
| 477 | static struct gpio_keys_button da850_evm_bb_keys[] = { | ||
| 478 | [0] = { | ||
| 479 | .type = EV_KEY, | ||
| 480 | .active_low = 1, | ||
| 481 | .wakeup = 0, | ||
| 482 | .debounce_interval = DA850_KEYS_DEBOUNCE_MS, | ||
| 483 | .code = KEY_PROG1, | ||
| 484 | .desc = NULL, /* assigned at runtime */ | ||
| 485 | .gpio = -1, /* assigned at runtime */ | ||
| 486 | }, | ||
| 487 | [1 ... DA850_N_BB_USER_SW] = { | ||
| 488 | .type = EV_SW, | ||
| 489 | .active_low = 1, | ||
| 490 | .wakeup = 0, | ||
| 491 | .debounce_interval = DA850_KEYS_DEBOUNCE_MS, | ||
| 492 | .code = -1, /* assigned at runtime */ | ||
| 493 | .desc = NULL, /* assigned at runtime */ | ||
| 494 | .gpio = -1, /* assigned at runtime */ | ||
| 495 | }, | ||
| 496 | }; | ||
| 497 | |||
| 498 | static struct gpio_keys_platform_data da850_evm_bb_keys_pdata = { | ||
| 499 | .buttons = da850_evm_bb_keys, | ||
| 500 | .nbuttons = ARRAY_SIZE(da850_evm_bb_keys), | ||
| 501 | .poll_interval = DA850_GPIO_KEYS_POLL_MS, | ||
| 502 | }; | ||
| 503 | |||
| 504 | static struct platform_device da850_evm_bb_keys_device = { | ||
| 505 | .name = "gpio-keys-polled", | ||
| 506 | .id = 1, | ||
| 507 | .dev = { | ||
| 508 | .platform_data = &da850_evm_bb_keys_pdata | ||
| 509 | }, | ||
| 510 | }; | ||
| 511 | |||
| 512 | static void da850_evm_bb_keys_init(unsigned gpio) | ||
| 513 | { | ||
| 514 | int i; | ||
| 515 | struct gpio_keys_button *button; | ||
| 516 | |||
| 517 | button = &da850_evm_bb_keys[0]; | ||
| 518 | button->desc = (char *) | ||
| 519 | da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1]; | ||
| 520 | button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1; | ||
| 521 | |||
| 522 | for (i = 0; i < DA850_N_BB_USER_SW; i++) { | ||
| 523 | button = &da850_evm_bb_keys[i + 1]; | ||
| 524 | button->code = SW_LID + i; | ||
| 525 | button->desc = (char *) | ||
| 526 | da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i]; | ||
| 527 | button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i; | ||
| 528 | } | ||
| 529 | } | ||
| 331 | 530 | ||
| 332 | gpio_free(gpio + 5); | 531 | #define DA850_N_BB_USER_LED 2 |
| 333 | gpio_free(gpio + 6); | 532 | |
| 334 | gpio_free(gpio + 7); | 533 | static struct gpio_led da850_evm_bb_leds[] = { |
| 534 | [0 ... DA850_N_BB_USER_LED - 1] = { | ||
| 535 | .active_low = 1, | ||
| 536 | .gpio = -1, /* assigned at runtime */ | ||
| 537 | .name = NULL, /* assigned at runtime */ | ||
| 538 | }, | ||
| 539 | }; | ||
| 540 | |||
| 541 | static struct gpio_led_platform_data da850_evm_bb_leds_pdata = { | ||
| 542 | .leds = da850_evm_bb_leds, | ||
| 543 | .num_leds = ARRAY_SIZE(da850_evm_bb_leds), | ||
| 544 | }; | ||
| 545 | |||
| 546 | static struct platform_device da850_evm_bb_leds_device = { | ||
| 547 | .name = "leds-gpio", | ||
| 548 | .id = -1, | ||
| 549 | .dev = { | ||
| 550 | .platform_data = &da850_evm_bb_leds_pdata | ||
| 551 | } | ||
| 552 | }; | ||
| 553 | |||
| 554 | static void da850_evm_bb_leds_init(unsigned gpio) | ||
| 555 | { | ||
| 556 | int i; | ||
| 557 | struct gpio_led *led; | ||
| 558 | |||
| 559 | for (i = 0; i < DA850_N_BB_USER_LED; i++) { | ||
| 560 | led = &da850_evm_bb_leds[i]; | ||
| 561 | |||
| 562 | led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i; | ||
| 563 | led->name = | ||
| 564 | da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i]; | ||
| 565 | } | ||
| 566 | } | ||
| 567 | |||
| 568 | static int da850_evm_bb_expander_setup(struct i2c_client *client, | ||
| 569 | unsigned gpio, unsigned ngpio, | ||
| 570 | void *c) | ||
| 571 | { | ||
| 572 | int ret; | ||
| 573 | |||
| 574 | /* | ||
| 575 | * Register the switches and pushbutton on the baseboard as a gpio-keys | ||
| 576 | * device. | ||
| 577 | */ | ||
| 578 | da850_evm_bb_keys_init(gpio); | ||
| 579 | ret = platform_device_register(&da850_evm_bb_keys_device); | ||
| 580 | if (ret) { | ||
| 581 | pr_warning("Could not register baseboard GPIO expander keys"); | ||
| 582 | goto io_exp_setup_sw_fail; | ||
| 583 | } | ||
| 584 | |||
| 585 | da850_evm_bb_leds_init(gpio); | ||
| 586 | ret = platform_device_register(&da850_evm_bb_leds_device); | ||
| 587 | if (ret) { | ||
| 588 | pr_warning("Could not register baseboard GPIO expander LEDS"); | ||
| 589 | goto io_exp_setup_leds_fail; | ||
| 590 | } | ||
| 591 | |||
| 592 | return 0; | ||
| 593 | |||
| 594 | io_exp_setup_leds_fail: | ||
| 595 | platform_device_unregister(&da850_evm_bb_keys_device); | ||
| 596 | io_exp_setup_sw_fail: | ||
| 597 | return ret; | ||
| 598 | } | ||
| 599 | |||
| 600 | static int da850_evm_bb_expander_teardown(struct i2c_client *client, | ||
| 601 | unsigned gpio, unsigned ngpio, void *c) | ||
| 602 | { | ||
| 603 | platform_device_unregister(&da850_evm_bb_leds_device); | ||
| 604 | platform_device_unregister(&da850_evm_bb_keys_device); | ||
| 335 | 605 | ||
| 336 | return 0; | 606 | return 0; |
| 337 | } | 607 | } |
| @@ -340,6 +610,14 @@ static struct pca953x_platform_data da850_evm_ui_expander_info = { | |||
| 340 | .gpio_base = DAVINCI_N_GPIO, | 610 | .gpio_base = DAVINCI_N_GPIO, |
| 341 | .setup = da850_evm_ui_expander_setup, | 611 | .setup = da850_evm_ui_expander_setup, |
| 342 | .teardown = da850_evm_ui_expander_teardown, | 612 | .teardown = da850_evm_ui_expander_teardown, |
| 613 | .names = da850_evm_ui_exp, | ||
| 614 | }; | ||
| 615 | |||
| 616 | static struct pca953x_platform_data da850_evm_bb_expander_info = { | ||
| 617 | .gpio_base = DA850_BB_EXPANDER_GPIO_BASE, | ||
| 618 | .setup = da850_evm_bb_expander_setup, | ||
| 619 | .teardown = da850_evm_bb_expander_teardown, | ||
| 620 | .names = da850_evm_bb_exp, | ||
| 343 | }; | 621 | }; |
| 344 | 622 | ||
| 345 | static struct i2c_board_info __initdata da850_evm_i2c_devices[] = { | 623 | static struct i2c_board_info __initdata da850_evm_i2c_devices[] = { |
| @@ -350,6 +628,10 @@ static struct i2c_board_info __initdata da850_evm_i2c_devices[] = { | |||
| 350 | I2C_BOARD_INFO("tca6416", 0x20), | 628 | I2C_BOARD_INFO("tca6416", 0x20), |
| 351 | .platform_data = &da850_evm_ui_expander_info, | 629 | .platform_data = &da850_evm_ui_expander_info, |
| 352 | }, | 630 | }, |
| 631 | { | ||
| 632 | I2C_BOARD_INFO("tca6416", 0x21), | ||
| 633 | .platform_data = &da850_evm_bb_expander_info, | ||
| 634 | }, | ||
| 353 | }; | 635 | }; |
| 354 | 636 | ||
| 355 | static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { | 637 | static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { |
| @@ -540,7 +822,7 @@ static struct regulator_init_data tps65070_regulator_data[] = { | |||
| 540 | { | 822 | { |
| 541 | .constraints = { | 823 | .constraints = { |
| 542 | .min_uV = 950000, | 824 | .min_uV = 950000, |
| 543 | .max_uV = 1320000, | 825 | .max_uV = 1350000, |
| 544 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | | 826 | .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | |
| 545 | REGULATOR_CHANGE_STATUS), | 827 | REGULATOR_CHANGE_STATUS), |
| 546 | .boot_on = 1, | 828 | .boot_on = 1, |
| @@ -591,7 +873,7 @@ static struct tps6507x_board tps_board = { | |||
| 591 | .tps6507x_ts_init_data = &tps6507x_touchscreen_data, | 873 | .tps6507x_ts_init_data = &tps6507x_touchscreen_data, |
| 592 | }; | 874 | }; |
| 593 | 875 | ||
| 594 | static struct i2c_board_info __initdata da850evm_tps65070_info[] = { | 876 | static struct i2c_board_info __initdata da850_evm_tps65070_info[] = { |
| 595 | { | 877 | { |
| 596 | I2C_BOARD_INFO("tps6507x", 0x48), | 878 | I2C_BOARD_INFO("tps6507x", 0x48), |
| 597 | .platform_data = &tps_board, | 879 | .platform_data = &tps_board, |
| @@ -600,8 +882,8 @@ static struct i2c_board_info __initdata da850evm_tps65070_info[] = { | |||
| 600 | 882 | ||
| 601 | static int __init pmic_tps65070_init(void) | 883 | static int __init pmic_tps65070_init(void) |
| 602 | { | 884 | { |
| 603 | return i2c_register_board_info(1, da850evm_tps65070_info, | 885 | return i2c_register_board_info(1, da850_evm_tps65070_info, |
| 604 | ARRAY_SIZE(da850evm_tps65070_info)); | 886 | ARRAY_SIZE(da850_evm_tps65070_info)); |
| 605 | } | 887 | } |
| 606 | 888 | ||
| 607 | static const short da850_evm_lcdc_pins[] = { | 889 | static const short da850_evm_lcdc_pins[] = { |
| @@ -736,6 +1018,27 @@ static struct edma_rsv_info *da850_edma_rsv[2] = { | |||
| 736 | &da850_edma_cc1_rsv, | 1018 | &da850_edma_cc1_rsv, |
| 737 | }; | 1019 | }; |
| 738 | 1020 | ||
| 1021 | #ifdef CONFIG_CPU_FREQ | ||
| 1022 | static __init int da850_evm_init_cpufreq(void) | ||
| 1023 | { | ||
| 1024 | switch (system_rev & 0xF) { | ||
| 1025 | case 3: | ||
| 1026 | da850_max_speed = 456000; | ||
| 1027 | break; | ||
| 1028 | case 2: | ||
| 1029 | da850_max_speed = 408000; | ||
| 1030 | break; | ||
| 1031 | case 1: | ||
| 1032 | da850_max_speed = 372000; | ||
| 1033 | break; | ||
| 1034 | } | ||
| 1035 | |||
| 1036 | return da850_register_cpufreq("pll0_sysclk3"); | ||
| 1037 | } | ||
| 1038 | #else | ||
| 1039 | static __init int da850_evm_init_cpufreq(void) { return 0; } | ||
| 1040 | #endif | ||
| 1041 | |||
| 739 | static __init void da850_evm_init(void) | 1042 | static __init void da850_evm_init(void) |
| 740 | { | 1043 | { |
| 741 | int ret; | 1044 | int ret; |
| @@ -836,7 +1139,7 @@ static __init void da850_evm_init(void) | |||
| 836 | if (ret) | 1139 | if (ret) |
| 837 | pr_warning("da850_evm_init: rtc setup failed: %d\n", ret); | 1140 | pr_warning("da850_evm_init: rtc setup failed: %d\n", ret); |
| 838 | 1141 | ||
| 839 | ret = da850_register_cpufreq("pll0_sysclk3"); | 1142 | ret = da850_evm_init_cpufreq(); |
| 840 | if (ret) | 1143 | if (ret) |
| 841 | pr_warning("da850_evm_init: cpufreq registration failed: %d\n", | 1144 | pr_warning("da850_evm_init: cpufreq registration failed: %d\n", |
| 842 | ret); | 1145 | ret); |
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c index 01ba080433db..e4e3af179f02 100644 --- a/arch/arm/mach-davinci/clock.c +++ b/arch/arm/mach-davinci/clock.c | |||
| @@ -336,7 +336,7 @@ int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate) | |||
| 336 | ratio--; | 336 | ratio--; |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | if (ratio > PLLDIV_RATIO_MASK) | 339 | if (ratio > pll->div_ratio_mask) |
| 340 | return -EINVAL; | 340 | return -EINVAL; |
| 341 | 341 | ||
| 342 | do { | 342 | do { |
| @@ -344,7 +344,7 @@ int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate) | |||
| 344 | } while (v & PLLSTAT_GOSTAT); | 344 | } while (v & PLLSTAT_GOSTAT); |
| 345 | 345 | ||
| 346 | v = __raw_readl(pll->base + clk->div_reg); | 346 | v = __raw_readl(pll->base + clk->div_reg); |
| 347 | v &= ~PLLDIV_RATIO_MASK; | 347 | v &= ~pll->div_ratio_mask; |
| 348 | v |= ratio | PLLDIV_EN; | 348 | v |= ratio | PLLDIV_EN; |
| 349 | __raw_writel(v, pll->base + clk->div_reg); | 349 | __raw_writel(v, pll->base + clk->div_reg); |
| 350 | 350 | ||
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 63916b902760..78b5ae29ae40 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c | |||
| @@ -830,8 +830,7 @@ static void da850_set_async3_src(int pllnum) | |||
| 830 | * According to the TRM, minimum PLLM results in maximum power savings. | 830 | * According to the TRM, minimum PLLM results in maximum power savings. |
| 831 | * The OPP definitions below should keep the PLLM as low as possible. | 831 | * The OPP definitions below should keep the PLLM as low as possible. |
| 832 | * | 832 | * |
| 833 | * The output of the PLLM must be between 400 to 600 MHz. | 833 | * The output of the PLLM must be between 300 to 600 MHz. |
| 834 | * This rules out prediv of anything but divide-by-one for 24Mhz OSC input. | ||
| 835 | */ | 834 | */ |
| 836 | struct da850_opp { | 835 | struct da850_opp { |
| 837 | unsigned int freq; /* in KHz */ | 836 | unsigned int freq; /* in KHz */ |
| @@ -842,6 +841,33 @@ struct da850_opp { | |||
| 842 | unsigned int cvdd_max; /* in uV */ | 841 | unsigned int cvdd_max; /* in uV */ |
| 843 | }; | 842 | }; |
| 844 | 843 | ||
| 844 | static const struct da850_opp da850_opp_456 = { | ||
| 845 | .freq = 456000, | ||
| 846 | .prediv = 1, | ||
| 847 | .mult = 19, | ||
| 848 | .postdiv = 1, | ||
| 849 | .cvdd_min = 1300000, | ||
| 850 | .cvdd_max = 1350000, | ||
| 851 | }; | ||
| 852 | |||
| 853 | static const struct da850_opp da850_opp_408 = { | ||
| 854 | .freq = 408000, | ||
| 855 | .prediv = 1, | ||
| 856 | .mult = 17, | ||
| 857 | .postdiv = 1, | ||
| 858 | .cvdd_min = 1300000, | ||
| 859 | .cvdd_max = 1350000, | ||
| 860 | }; | ||
| 861 | |||
| 862 | static const struct da850_opp da850_opp_372 = { | ||
| 863 | .freq = 372000, | ||
| 864 | .prediv = 2, | ||
| 865 | .mult = 31, | ||
| 866 | .postdiv = 1, | ||
| 867 | .cvdd_min = 1200000, | ||
| 868 | .cvdd_max = 1320000, | ||
| 869 | }; | ||
| 870 | |||
| 845 | static const struct da850_opp da850_opp_300 = { | 871 | static const struct da850_opp da850_opp_300 = { |
| 846 | .freq = 300000, | 872 | .freq = 300000, |
| 847 | .prediv = 1, | 873 | .prediv = 1, |
| @@ -876,6 +902,9 @@ static const struct da850_opp da850_opp_96 = { | |||
| 876 | } | 902 | } |
| 877 | 903 | ||
| 878 | static struct cpufreq_frequency_table da850_freq_table[] = { | 904 | static struct cpufreq_frequency_table da850_freq_table[] = { |
| 905 | OPP(456), | ||
| 906 | OPP(408), | ||
| 907 | OPP(372), | ||
| 879 | OPP(300), | 908 | OPP(300), |
| 880 | OPP(200), | 909 | OPP(200), |
| 881 | OPP(96), | 910 | OPP(96), |
| @@ -886,6 +915,19 @@ static struct cpufreq_frequency_table da850_freq_table[] = { | |||
| 886 | }; | 915 | }; |
| 887 | 916 | ||
| 888 | #ifdef CONFIG_REGULATOR | 917 | #ifdef CONFIG_REGULATOR |
| 918 | static int da850_set_voltage(unsigned int index); | ||
| 919 | static int da850_regulator_init(void); | ||
| 920 | #endif | ||
| 921 | |||
| 922 | static struct davinci_cpufreq_config cpufreq_info = { | ||
| 923 | .freq_table = da850_freq_table, | ||
| 924 | #ifdef CONFIG_REGULATOR | ||
| 925 | .init = da850_regulator_init, | ||
| 926 | .set_voltage = da850_set_voltage, | ||
| 927 | #endif | ||
| 928 | }; | ||
| 929 | |||
| 930 | #ifdef CONFIG_REGULATOR | ||
| 889 | static struct regulator *cvdd; | 931 | static struct regulator *cvdd; |
| 890 | 932 | ||
| 891 | static int da850_set_voltage(unsigned int index) | 933 | static int da850_set_voltage(unsigned int index) |
| @@ -895,7 +937,7 @@ static int da850_set_voltage(unsigned int index) | |||
| 895 | if (!cvdd) | 937 | if (!cvdd) |
| 896 | return -ENODEV; | 938 | return -ENODEV; |
| 897 | 939 | ||
| 898 | opp = (struct da850_opp *) da850_freq_table[index].index; | 940 | opp = (struct da850_opp *) cpufreq_info.freq_table[index].index; |
| 899 | 941 | ||
| 900 | return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max); | 942 | return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max); |
| 901 | } | 943 | } |
| @@ -912,14 +954,6 @@ static int da850_regulator_init(void) | |||
| 912 | } | 954 | } |
| 913 | #endif | 955 | #endif |
| 914 | 956 | ||
| 915 | static struct davinci_cpufreq_config cpufreq_info = { | ||
| 916 | .freq_table = &da850_freq_table[0], | ||
| 917 | #ifdef CONFIG_REGULATOR | ||
| 918 | .init = da850_regulator_init, | ||
| 919 | .set_voltage = da850_set_voltage, | ||
| 920 | #endif | ||
| 921 | }; | ||
| 922 | |||
| 923 | static struct platform_device da850_cpufreq_device = { | 957 | static struct platform_device da850_cpufreq_device = { |
| 924 | .name = "cpufreq-davinci", | 958 | .name = "cpufreq-davinci", |
| 925 | .dev = { | 959 | .dev = { |
| @@ -928,12 +962,22 @@ static struct platform_device da850_cpufreq_device = { | |||
| 928 | .id = -1, | 962 | .id = -1, |
| 929 | }; | 963 | }; |
| 930 | 964 | ||
| 965 | unsigned int da850_max_speed = 300000; | ||
| 966 | |||
| 931 | int __init da850_register_cpufreq(char *async_clk) | 967 | int __init da850_register_cpufreq(char *async_clk) |
| 932 | { | 968 | { |
| 969 | int i; | ||
| 970 | |||
| 933 | /* cpufreq driver can help keep an "async" clock constant */ | 971 | /* cpufreq driver can help keep an "async" clock constant */ |
| 934 | if (async_clk) | 972 | if (async_clk) |
| 935 | clk_add_alias("async", da850_cpufreq_device.name, | 973 | clk_add_alias("async", da850_cpufreq_device.name, |
| 936 | async_clk, NULL); | 974 | async_clk, NULL); |
| 975 | for (i = 0; i < ARRAY_SIZE(da850_freq_table); i++) { | ||
| 976 | if (da850_freq_table[i].frequency <= da850_max_speed) { | ||
| 977 | cpufreq_info.freq_table = &da850_freq_table[i]; | ||
| 978 | break; | ||
| 979 | } | ||
| 980 | } | ||
| 937 | 981 | ||
| 938 | return platform_device_register(&da850_cpufreq_device); | 982 | return platform_device_register(&da850_cpufreq_device); |
| 939 | } | 983 | } |
| @@ -942,17 +986,18 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate) | |||
| 942 | { | 986 | { |
| 943 | int i, ret = 0, diff; | 987 | int i, ret = 0, diff; |
| 944 | unsigned int best = (unsigned int) -1; | 988 | unsigned int best = (unsigned int) -1; |
| 989 | struct cpufreq_frequency_table *table = cpufreq_info.freq_table; | ||
| 945 | 990 | ||
| 946 | rate /= 1000; /* convert to kHz */ | 991 | rate /= 1000; /* convert to kHz */ |
| 947 | 992 | ||
| 948 | for (i = 0; da850_freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { | 993 | for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) { |
| 949 | diff = da850_freq_table[i].frequency - rate; | 994 | diff = table[i].frequency - rate; |
| 950 | if (diff < 0) | 995 | if (diff < 0) |
| 951 | diff = -diff; | 996 | diff = -diff; |
| 952 | 997 | ||
| 953 | if (diff < best) { | 998 | if (diff < best) { |
| 954 | best = diff; | 999 | best = diff; |
| 955 | ret = da850_freq_table[i].frequency; | 1000 | ret = table[i].frequency; |
| 956 | } | 1001 | } |
| 957 | } | 1002 | } |
| 958 | 1003 | ||
| @@ -973,7 +1018,7 @@ static int da850_set_pll0rate(struct clk *clk, unsigned long index) | |||
| 973 | struct pll_data *pll = clk->pll_data; | 1018 | struct pll_data *pll = clk->pll_data; |
| 974 | int ret; | 1019 | int ret; |
| 975 | 1020 | ||
| 976 | opp = (struct da850_opp *) da850_freq_table[index].index; | 1021 | opp = (struct da850_opp *) cpufreq_info.freq_table[index].index; |
| 977 | prediv = opp->prediv; | 1022 | prediv = opp->prediv; |
| 978 | mult = opp->mult; | 1023 | mult = opp->mult; |
| 979 | postdiv = opp->postdiv; | 1024 | postdiv = opp->postdiv; |
diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c index c9a86d8130d1..85503debda51 100644 --- a/arch/arm/mach-davinci/devices-tnetv107x.c +++ b/arch/arm/mach-davinci/devices-tnetv107x.c | |||
| @@ -344,7 +344,20 @@ static struct platform_device tsc_device = { | |||
| 344 | 344 | ||
| 345 | void __init tnetv107x_devices_init(struct tnetv107x_device_info *info) | 345 | void __init tnetv107x_devices_init(struct tnetv107x_device_info *info) |
| 346 | { | 346 | { |
| 347 | int i; | 347 | int i, error; |
| 348 | struct clk *tsc_clk; | ||
| 349 | |||
| 350 | /* | ||
| 351 | * The reset defaults for tnetv107x tsc clock divider is set too high. | ||
| 352 | * This forces the clock down to a range that allows the ADC to | ||
| 353 | * complete sample conversion in time. | ||
| 354 | */ | ||
| 355 | tsc_clk = clk_get(NULL, "sys_tsc_clk"); | ||
| 356 | if (tsc_clk) { | ||
| 357 | error = clk_set_rate(tsc_clk, 5000000); | ||
| 358 | WARN_ON(error < 0); | ||
| 359 | clk_put(tsc_clk); | ||
| 360 | } | ||
| 348 | 361 | ||
| 349 | platform_device_register(&edma_device); | 362 | platform_device_register(&edma_device); |
| 350 | platform_device_register(&tnetv107x_wdt_device); | 363 | platform_device_register(&tnetv107x_wdt_device); |
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 4247b3f53b33..e7f952066527 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h | |||
| @@ -28,6 +28,13 @@ extern void __iomem *da8xx_syscfg0_base; | |||
| 28 | extern void __iomem *da8xx_syscfg1_base; | 28 | extern void __iomem *da8xx_syscfg1_base; |
| 29 | 29 | ||
| 30 | /* | 30 | /* |
| 31 | * If the DA850/OMAP-L138/AM18x SoC on board is of a higher speed grade | ||
| 32 | * (than the regular 300Mhz variant), the board code should set this up | ||
| 33 | * with the supported speed before calling da850_register_cpufreq(). | ||
| 34 | */ | ||
| 35 | extern unsigned int da850_max_speed; | ||
| 36 | |||
| 37 | /* | ||
| 31 | * The cp_intc interrupt controller for the da8xx isn't in the same | 38 | * The cp_intc interrupt controller for the da8xx isn't in the same |
| 32 | * chunk of physical memory space as the other registers (like it is | 39 | * chunk of physical memory space as the other registers (like it is |
| 33 | * on the davincis) so it needs to be mapped separately. It will be | 40 | * on the davincis) so it needs to be mapped separately. It will be |
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c index 1b15dbd0a77b..a41580400701 100644 --- a/arch/arm/mach-davinci/psc.c +++ b/arch/arm/mach-davinci/psc.c | |||
| @@ -83,21 +83,16 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr, | |||
| 83 | pdctl1 = __raw_readl(psc_base + PDCTL1); | 83 | pdctl1 = __raw_readl(psc_base + PDCTL1); |
| 84 | pdctl1 |= 0x100; | 84 | pdctl1 |= 0x100; |
| 85 | __raw_writel(pdctl1, psc_base + PDCTL1); | 85 | __raw_writel(pdctl1, psc_base + PDCTL1); |
| 86 | |||
| 87 | do { | ||
| 88 | ptstat = __raw_readl(psc_base + | ||
| 89 | PTSTAT); | ||
| 90 | } while (!(((ptstat >> domain) & 1) == 0)); | ||
| 91 | } else { | 86 | } else { |
| 92 | ptcmd = 1 << domain; | 87 | ptcmd = 1 << domain; |
| 93 | __raw_writel(ptcmd, psc_base + PTCMD); | 88 | __raw_writel(ptcmd, psc_base + PTCMD); |
| 94 | |||
| 95 | do { | ||
| 96 | ptstat = __raw_readl(psc_base + PTSTAT); | ||
| 97 | } while (!(((ptstat >> domain) & 1) == 0)); | ||
| 98 | } | 89 | } |
| 99 | 90 | ||
| 100 | do { | 91 | do { |
| 92 | ptstat = __raw_readl(psc_base + PTSTAT); | ||
| 93 | } while (!(((ptstat >> domain) & 1) == 0)); | ||
| 94 | |||
| 95 | do { | ||
| 101 | mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); | 96 | mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); |
| 102 | } while (!((mdstat & MDSTAT_STATE_MASK) == next_state)); | 97 | } while (!((mdstat & MDSTAT_STATE_MASK) == next_state)); |
| 103 | 98 | ||
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index 0f21c36e65dd..5d1eea026635 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c | |||
| @@ -272,15 +272,36 @@ static cycle_t read_cycles(struct clocksource *cs) | |||
| 272 | return (cycles_t)timer32_read(t); | 272 | return (cycles_t)timer32_read(t); |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | /* | ||
| 276 | * Kernel assumes that sched_clock can be called early but may not have | ||
| 277 | * things ready yet. | ||
| 278 | */ | ||
| 279 | static cycle_t read_dummy(struct clocksource *cs) | ||
| 280 | { | ||
| 281 | return 0; | ||
| 282 | } | ||
| 283 | |||
| 284 | |||
| 275 | static struct clocksource clocksource_davinci = { | 285 | static struct clocksource clocksource_davinci = { |
| 276 | .rating = 300, | 286 | .rating = 300, |
| 277 | .read = read_cycles, | 287 | .read = read_dummy, |
| 278 | .mask = CLOCKSOURCE_MASK(32), | 288 | .mask = CLOCKSOURCE_MASK(32), |
| 279 | .shift = 24, | 289 | .shift = 24, |
| 280 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 290 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
| 281 | }; | 291 | }; |
| 282 | 292 | ||
| 283 | /* | 293 | /* |
| 294 | * Overwrite weak default sched_clock with something more precise | ||
| 295 | */ | ||
| 296 | unsigned long long notrace sched_clock(void) | ||
| 297 | { | ||
| 298 | const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci); | ||
| 299 | |||
| 300 | return clocksource_cyc2ns(cyc, clocksource_davinci.mult, | ||
| 301 | clocksource_davinci.shift); | ||
| 302 | } | ||
| 303 | |||
| 304 | /* | ||
| 284 | * clockevent | 305 | * clockevent |
| 285 | */ | 306 | */ |
| 286 | static int davinci_set_next_event(unsigned long cycles, | 307 | static int davinci_set_next_event(unsigned long cycles, |
| @@ -377,6 +398,7 @@ static void __init davinci_timer_init(void) | |||
| 377 | davinci_clock_tick_rate = clk_get_rate(timer_clk); | 398 | davinci_clock_tick_rate = clk_get_rate(timer_clk); |
| 378 | 399 | ||
| 379 | /* setup clocksource */ | 400 | /* setup clocksource */ |
| 401 | clocksource_davinci.read = read_cycles; | ||
| 380 | clocksource_davinci.name = id_to_name[clocksource_id]; | 402 | clocksource_davinci.name = id_to_name[clocksource_id]; |
| 381 | clocksource_davinci.mult = | 403 | clocksource_davinci.mult = |
| 382 | clocksource_khz2mult(davinci_clock_tick_rate/1000, | 404 | clocksource_khz2mult(davinci_clock_tick_rate/1000, |
diff --git a/arch/arm/mach-davinci/tnetv107x.c b/arch/arm/mach-davinci/tnetv107x.c index daeae06430b9..6fcdecec8d8c 100644 --- a/arch/arm/mach-davinci/tnetv107x.c +++ b/arch/arm/mach-davinci/tnetv107x.c | |||
| @@ -131,12 +131,13 @@ define_pll_clk(tdm, 1, 0x0ff, 0x200); | |||
| 131 | define_pll_clk(eth, 2, 0x0ff, 0x400); | 131 | define_pll_clk(eth, 2, 0x0ff, 0x400); |
| 132 | 132 | ||
| 133 | /* Level 2 - divided outputs from the PLLs */ | 133 | /* Level 2 - divided outputs from the PLLs */ |
| 134 | #define define_pll_div_clk(pll, cname, div) \ | 134 | #define define_pll_div_clk(pll, cname, div) \ |
| 135 | static struct clk pll##_##cname##_clk = { \ | 135 | static struct clk pll##_##cname##_clk = { \ |
| 136 | .name = #pll "_" #cname "_clk",\ | 136 | .name = #pll "_" #cname "_clk", \ |
| 137 | .parent = &pll_##pll##_clk, \ | 137 | .parent = &pll_##pll##_clk, \ |
| 138 | .flags = CLK_PLL, \ | 138 | .flags = CLK_PLL, \ |
| 139 | .div_reg = PLLDIV##div, \ | 139 | .div_reg = PLLDIV##div, \ |
| 140 | .set_rate = davinci_set_sysclk_rate, \ | ||
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | define_pll_div_clk(sys, arm1176, 1); | 143 | define_pll_div_clk(sys, arm1176, 1); |
| @@ -192,6 +193,7 @@ lpsc_clk_enabled(system, sys_half_clk, SYSTEM); | |||
| 192 | lpsc_clk_enabled(ddr2_vrst, sys_ddr_clk, DDR2_EMIF1_VRST); | 193 | lpsc_clk_enabled(ddr2_vrst, sys_ddr_clk, DDR2_EMIF1_VRST); |
| 193 | lpsc_clk_enabled(ddr2_vctl_rst, sys_ddr_clk, DDR2_EMIF2_VCTL_RST); | 194 | lpsc_clk_enabled(ddr2_vctl_rst, sys_ddr_clk, DDR2_EMIF2_VCTL_RST); |
| 194 | lpsc_clk_enabled(wdt_arm, sys_half_clk, WDT_ARM); | 195 | lpsc_clk_enabled(wdt_arm, sys_half_clk, WDT_ARM); |
| 196 | lpsc_clk_enabled(timer1, sys_half_clk, TIMER1); | ||
| 195 | 197 | ||
| 196 | lpsc_clk(mbx_lite, sys_arm1176_clk, MBX_LITE); | 198 | lpsc_clk(mbx_lite, sys_arm1176_clk, MBX_LITE); |
| 197 | lpsc_clk(ethss, eth_125mhz_clk, ETHSS); | 199 | lpsc_clk(ethss, eth_125mhz_clk, ETHSS); |
| @@ -205,16 +207,15 @@ lpsc_clk(mdio, sys_half_clk, MDIO); | |||
| 205 | lpsc_clk(sdio0, sys_half_clk, SDIO0); | 207 | lpsc_clk(sdio0, sys_half_clk, SDIO0); |
| 206 | lpsc_clk(sdio1, sys_half_clk, SDIO1); | 208 | lpsc_clk(sdio1, sys_half_clk, SDIO1); |
| 207 | lpsc_clk(timer0, sys_half_clk, TIMER0); | 209 | lpsc_clk(timer0, sys_half_clk, TIMER0); |
| 208 | lpsc_clk(timer1, sys_half_clk, TIMER1); | ||
| 209 | lpsc_clk(wdt_dsp, sys_half_clk, WDT_DSP); | 210 | lpsc_clk(wdt_dsp, sys_half_clk, WDT_DSP); |
| 210 | lpsc_clk(ssp, sys_half_clk, SSP); | 211 | lpsc_clk(ssp, sys_half_clk, SSP); |
| 211 | lpsc_clk(tdm0, tdm_0_clk, TDM0); | 212 | lpsc_clk(tdm0, tdm_0_clk, TDM0); |
| 212 | lpsc_clk(tdm1, tdm_1_clk, TDM1); | 213 | lpsc_clk(tdm1, tdm_1_clk, TDM1); |
| 213 | lpsc_clk(vlynq, sys_vlynq_ref_clk, VLYNQ); | 214 | lpsc_clk(vlynq, sys_vlynq_ref_clk, VLYNQ); |
| 214 | lpsc_clk(mcdma, sys_half_clk, MCDMA); | 215 | lpsc_clk(mcdma, sys_half_clk, MCDMA); |
| 215 | lpsc_clk(usb0, sys_half_clk, USB0); | ||
| 216 | lpsc_clk(usb1, sys_half_clk, USB1); | ||
| 217 | lpsc_clk(usbss, sys_half_clk, USBSS); | 216 | lpsc_clk(usbss, sys_half_clk, USBSS); |
| 217 | lpsc_clk(usb0, clk_usbss, USB0); | ||
| 218 | lpsc_clk(usb1, clk_usbss, USB1); | ||
| 218 | lpsc_clk(ethss_rgmii, eth_250mhz_clk, ETHSS_RGMII); | 219 | lpsc_clk(ethss_rgmii, eth_250mhz_clk, ETHSS_RGMII); |
| 219 | lpsc_clk(imcop, sys_dsp_clk, IMCOP); | 220 | lpsc_clk(imcop, sys_dsp_clk, IMCOP); |
| 220 | lpsc_clk(spare, sys_half_clk, SPARE); | 221 | lpsc_clk(spare, sys_half_clk, SPARE); |
| @@ -281,7 +282,9 @@ static struct clk_lookup clks[] = { | |||
| 281 | CLK(NULL, "clk_tdm0", &clk_tdm0), | 282 | CLK(NULL, "clk_tdm0", &clk_tdm0), |
| 282 | CLK(NULL, "clk_vlynq", &clk_vlynq), | 283 | CLK(NULL, "clk_vlynq", &clk_vlynq), |
| 283 | CLK(NULL, "clk_mcdma", &clk_mcdma), | 284 | CLK(NULL, "clk_mcdma", &clk_mcdma), |
| 285 | CLK(NULL, "clk_usbss", &clk_usbss), | ||
| 284 | CLK(NULL, "clk_usb0", &clk_usb0), | 286 | CLK(NULL, "clk_usb0", &clk_usb0), |
| 287 | CLK(NULL, "clk_usb1", &clk_usb1), | ||
| 285 | CLK(NULL, "clk_tdm1", &clk_tdm1), | 288 | CLK(NULL, "clk_tdm1", &clk_tdm1), |
| 286 | CLK(NULL, "clk_debugss", &clk_debugss), | 289 | CLK(NULL, "clk_debugss", &clk_debugss), |
| 287 | CLK(NULL, "clk_ethss_rgmii", &clk_ethss_rgmii), | 290 | CLK(NULL, "clk_ethss_rgmii", &clk_ethss_rgmii), |
| @@ -289,8 +292,6 @@ static struct clk_lookup clks[] = { | |||
| 289 | CLK(NULL, "clk_imcop", &clk_imcop), | 292 | CLK(NULL, "clk_imcop", &clk_imcop), |
| 290 | CLK(NULL, "clk_spare", &clk_spare), | 293 | CLK(NULL, "clk_spare", &clk_spare), |
| 291 | CLK("davinci_mmc.1", NULL, &clk_sdio1), | 294 | CLK("davinci_mmc.1", NULL, &clk_sdio1), |
| 292 | CLK(NULL, "clk_usb1", &clk_usb1), | ||
| 293 | CLK(NULL, "clk_usbss", &clk_usbss), | ||
| 294 | CLK(NULL, "clk_ddr2_vrst", &clk_ddr2_vrst), | 295 | CLK(NULL, "clk_ddr2_vrst", &clk_ddr2_vrst), |
| 295 | CLK(NULL, "clk_ddr2_vctl_rst", &clk_ddr2_vctl_rst), | 296 | CLK(NULL, "clk_ddr2_vctl_rst", &clk_ddr2_vctl_rst), |
| 296 | CLK(NULL, NULL, NULL), | 297 | CLK(NULL, NULL, NULL), |
