Merge branch 'rmobile-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6

* 'rmobile-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
mmc: sh_mmcif: Convert extern inline to static inline.
ARM: mach-shmobile: Allow GPIO chips to register IRQ mappings.
ARM: mach-shmobile: fix sh7372 after a recent clock framework rework
ARM: mach-shmobile: include drivers/sh/Kconfig
ARM: mach-shmobile: ap4evb: Add HDMI sound support
ARM: mach-shmobile: clock-sh7372: Add FSIDIV clock support
ARM: shmobile: remove sh_timer_config clk member

+171 -34
+2
arch/arm/mach-shmobile/Kconfig
··· 116 config SH_CLK_CPG 117 bool 118 119 endif
··· 116 config SH_CLK_CPG 117 bool 118 119 + source "drivers/sh/Kconfig" 120 + 121 endif
+45 -1
arch/arm/mach-shmobile/board-ap4evb.c
··· 565 566 /* FSI */ 567 #define IRQ_FSI evt2irq(0x1840) 568 static struct sh_fsi_platform_info fsi_info = { 569 .porta_flags = SH_FSI_BRS_INV | 570 SH_FSI_OUT_SLAVE_MODE | 571 SH_FSI_IN_SLAVE_MODE | 572 SH_FSI_OFMT(PCM) | 573 SH_FSI_IFMT(PCM), 574 }; 575 576 static struct resource fsi_resources[] = { ··· 672 static struct sh_mobile_hdmi_info hdmi_info = { 673 .lcd_chan = &sh_mobile_lcdc1_info.ch[0], 674 .lcd_dev = &lcdc1_device.dev, 675 }; 676 677 static struct resource hdmi_resources[] = { ··· 1031 1032 #define GPIO_PORT9CR 0xE6051009 1033 #define GPIO_PORT10CR 0xE605100A 1034 static void __init ap4evb_init(void) 1035 { 1036 u32 srcr4; ··· 1102 /* setup USB phy */ 1103 __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */ 1104 1105 - /* enable FSI2 */ 1106 gpio_request(GPIO_FN_FSIAIBT, NULL); 1107 gpio_request(GPIO_FN_FSIAILR, NULL); 1108 gpio_request(GPIO_FN_FSIAISLD, NULL); ··· 1118 /* card detect pin for MMC slot (CN7) */ 1119 gpio_request(GPIO_PORT41, NULL); 1120 gpio_direction_input(GPIO_PORT41); 1121 1122 /* set SPU2 clock to 119.6 MHz */ 1123 clk = clk_get(NULL, "spu_clk");
··· 565 566 /* FSI */ 567 #define IRQ_FSI evt2irq(0x1840) 568 + 569 + static int fsi_set_rate(int is_porta, int rate) 570 + { 571 + struct clk *fsib_clk; 572 + struct clk *fdiv_clk = &sh7372_fsidivb_clk; 573 + int ret; 574 + 575 + /* set_rate is not needed if port A */ 576 + if (is_porta) 577 + return 0; 578 + 579 + fsib_clk = clk_get(NULL, "fsib_clk"); 580 + if (IS_ERR(fsib_clk)) 581 + return -EINVAL; 582 + 583 + switch (rate) { 584 + case 48000: 585 + clk_set_rate(fsib_clk, clk_round_rate(fsib_clk, 85428000)); 586 + clk_set_rate(fdiv_clk, clk_round_rate(fdiv_clk, 12204000)); 587 + ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64; 588 + break; 589 + default: 590 + pr_err("unsupported rate in FSI2 port B\n"); 591 + ret = -EINVAL; 592 + break; 593 + } 594 + 595 + clk_put(fsib_clk); 596 + 597 + return ret; 598 + } 599 + 600 static struct sh_fsi_platform_info fsi_info = { 601 .porta_flags = SH_FSI_BRS_INV | 602 SH_FSI_OUT_SLAVE_MODE | 603 SH_FSI_IN_SLAVE_MODE | 604 SH_FSI_OFMT(PCM) | 605 SH_FSI_IFMT(PCM), 606 + 607 + .portb_flags = SH_FSI_BRS_INV | 608 + SH_FSI_BRM_INV | 609 + SH_FSI_LRS_INV | 610 + SH_FSI_OFMT(SPDIF), 611 + .set_rate = fsi_set_rate, 612 }; 613 614 static struct resource fsi_resources[] = { ··· 634 static struct sh_mobile_hdmi_info hdmi_info = { 635 .lcd_chan = &sh_mobile_lcdc1_info.ch[0], 636 .lcd_dev = &lcdc1_device.dev, 637 + .flags = HDMI_SND_SRC_SPDIF, 638 }; 639 640 static struct resource hdmi_resources[] = { ··· 992 993 #define GPIO_PORT9CR 0xE6051009 994 #define GPIO_PORT10CR 0xE605100A 995 + #define USCCR1 0xE6058144 996 static void __init ap4evb_init(void) 997 { 998 u32 srcr4; ··· 1062 /* setup USB phy */ 1063 __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */ 1064 1065 + /* enable FSI2 port A (ak4643) */ 1066 gpio_request(GPIO_FN_FSIAIBT, NULL); 1067 gpio_request(GPIO_FN_FSIAILR, NULL); 1068 gpio_request(GPIO_FN_FSIAISLD, NULL); ··· 1078 /* card detect pin for MMC slot (CN7) */ 1079 gpio_request(GPIO_PORT41, NULL); 1080 gpio_direction_input(GPIO_PORT41); 1081 + 1082 + /* setup FSI2 port B (HDMI) */ 1083 + gpio_request(GPIO_FN_FSIBCK, NULL); 1084 + __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */ 1085 1086 /* set SPU2 clock to 119.6 MHz */ 1087 clk = clk_get(NULL, "spu_clk");
+102
arch/arm/mach-shmobile/clock-sh7372.c
··· 50 #define SMSTPCR3 0xe615013c 51 #define SMSTPCR4 0xe6150140 52 53 /* Platforms must set frequency on their DV_CLKI pin */ 54 struct clk sh7372_dv_clki_clk = { 55 }; ··· 291 .ops = &pllc2_clk_ops, 292 .parent = &extal1_div2_clk, 293 .freq_table = pllc2_freq_table, 294 .parent_table = pllc2_parent, 295 .parent_num = ARRAY_SIZE(pllc2_parent), 296 }; ··· 419 fsiackcr_parent, ARRAY_SIZE(fsiackcr_parent), 6, 2), 420 [DIV6_FSIB] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, FSIBCKCR, 0, 421 fsibckcr_parent, ARRAY_SIZE(fsibckcr_parent), 6, 2), 422 }; 423 424 enum { MSTP001, ··· 683 684 if (!ret) 685 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 686 687 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 688
··· 50 #define SMSTPCR3 0xe615013c 51 #define SMSTPCR4 0xe6150140 52 53 + #define FSIDIVA 0xFE1F8000 54 + #define FSIDIVB 0xFE1F8008 55 + 56 /* Platforms must set frequency on their DV_CLKI pin */ 57 struct clk sh7372_dv_clki_clk = { 58 }; ··· 288 .ops = &pllc2_clk_ops, 289 .parent = &extal1_div2_clk, 290 .freq_table = pllc2_freq_table, 291 + .nr_freqs = ARRAY_SIZE(pllc2_freq_table) - 1, 292 .parent_table = pllc2_parent, 293 .parent_num = ARRAY_SIZE(pllc2_parent), 294 }; ··· 415 fsiackcr_parent, ARRAY_SIZE(fsiackcr_parent), 6, 2), 416 [DIV6_FSIB] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, FSIBCKCR, 0, 417 fsibckcr_parent, ARRAY_SIZE(fsibckcr_parent), 6, 2), 418 + }; 419 + 420 + /* FSI DIV */ 421 + static unsigned long fsidiv_recalc(struct clk *clk) 422 + { 423 + unsigned long value; 424 + 425 + value = __raw_readl(clk->mapping->base); 426 + 427 + if ((value & 0x3) != 0x3) 428 + return 0; 429 + 430 + value >>= 16; 431 + if (value < 2) 432 + return 0; 433 + 434 + return clk->parent->rate / value; 435 + } 436 + 437 + static long fsidiv_round_rate(struct clk *clk, unsigned long rate) 438 + { 439 + return clk_rate_div_range_round(clk, 2, 0xffff, rate); 440 + } 441 + 442 + static void fsidiv_disable(struct clk *clk) 443 + { 444 + __raw_writel(0, clk->mapping->base); 445 + } 446 + 447 + static int fsidiv_enable(struct clk *clk) 448 + { 449 + unsigned long value; 450 + 451 + value = __raw_readl(clk->mapping->base) >> 16; 452 + if (value < 2) { 453 + fsidiv_disable(clk); 454 + return -ENOENT; 455 + } 456 + 457 + __raw_writel((value << 16) | 0x3, clk->mapping->base); 458 + 459 + return 0; 460 + } 461 + 462 + static int fsidiv_set_rate(struct clk *clk, 463 + unsigned long rate, int algo_id) 464 + { 465 + int idx; 466 + 467 + if (clk->parent->rate == rate) { 468 + fsidiv_disable(clk); 469 + return 0; 470 + } 471 + 472 + idx = (clk->parent->rate / rate) & 0xffff; 473 + if (idx < 2) 474 + return -ENOENT; 475 + 476 + __raw_writel(idx << 16, clk->mapping->base); 477 + return fsidiv_enable(clk); 478 + } 479 + 480 + static struct clk_ops fsidiv_clk_ops = { 481 + .recalc = fsidiv_recalc, 482 + .round_rate = fsidiv_round_rate, 483 + .set_rate = fsidiv_set_rate, 484 + .enable = fsidiv_enable, 485 + .disable = fsidiv_disable, 486 + }; 487 + 488 + static struct clk_mapping sh7372_fsidiva_clk_mapping = { 489 + .phys = FSIDIVA, 490 + .len = 8, 491 + }; 492 + 493 + struct clk sh7372_fsidiva_clk = { 494 + .ops = &fsidiv_clk_ops, 495 + .parent = &div6_reparent_clks[DIV6_FSIA], /* late install */ 496 + .mapping = &sh7372_fsidiva_clk_mapping, 497 + }; 498 + 499 + static struct clk_mapping sh7372_fsidivb_clk_mapping = { 500 + .phys = FSIDIVB, 501 + .len = 8, 502 + }; 503 + 504 + struct clk sh7372_fsidivb_clk = { 505 + .ops = &fsidiv_clk_ops, 506 + .parent = &div6_reparent_clks[DIV6_FSIB], /* late install */ 507 + .mapping = &sh7372_fsidivb_clk_mapping, 508 + }; 509 + 510 + static struct clk *late_main_clks[] = { 511 + &sh7372_fsidiva_clk, 512 + &sh7372_fsidivb_clk, 513 }; 514 515 enum { MSTP001, ··· 584 585 if (!ret) 586 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 587 + 588 + for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) 589 + ret = clk_register(late_main_clks[k]); 590 591 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 592
+2 -2
arch/arm/mach-shmobile/include/mach/gpio.h
··· 35 36 static inline int gpio_to_irq(unsigned gpio) 37 { 38 - return -ENOSYS; 39 } 40 41 static inline int irq_to_gpio(unsigned int irq) 42 { 43 - return -EINVAL; 44 } 45 46 #endif /* CONFIG_GPIOLIB */
··· 35 36 static inline int gpio_to_irq(unsigned gpio) 37 { 38 + return __gpio_to_irq(gpio); 39 } 40 41 static inline int irq_to_gpio(unsigned int irq) 42 { 43 + return -ENOSYS; 44 } 45 46 #endif /* CONFIG_GPIOLIB */
+2
arch/arm/mach-shmobile/include/mach/sh7372.h
··· 464 extern struct clk sh7372_pllc2_clk; 465 extern struct clk sh7372_fsiack_clk; 466 extern struct clk sh7372_fsibck_clk; 467 468 #endif /* __ASM_SH7372_H__ */
··· 464 extern struct clk sh7372_pllc2_clk; 465 extern struct clk sh7372_fsiack_clk; 466 extern struct clk sh7372_fsibck_clk; 467 + extern struct clk sh7372_fsidiva_clk; 468 + extern struct clk sh7372_fsidivb_clk; 469 470 #endif /* __ASM_SH7372_H__ */
+3 -7
drivers/clocksource/sh_cmt.c
··· 616 /* get hold of clock */ 617 p->clk = clk_get(&p->pdev->dev, "cmt_fck"); 618 if (IS_ERR(p->clk)) { 619 - dev_warn(&p->pdev->dev, "using deprecated clock lookup\n"); 620 - p->clk = clk_get(&p->pdev->dev, cfg->clk); 621 - if (IS_ERR(p->clk)) { 622 - dev_err(&p->pdev->dev, "cannot get clock\n"); 623 - ret = PTR_ERR(p->clk); 624 - goto err1; 625 - } 626 } 627 628 if (resource_size(res) == 6) {
··· 616 /* get hold of clock */ 617 p->clk = clk_get(&p->pdev->dev, "cmt_fck"); 618 if (IS_ERR(p->clk)) { 619 + dev_err(&p->pdev->dev, "cannot get clock\n"); 620 + ret = PTR_ERR(p->clk); 621 + goto err1; 622 } 623 624 if (resource_size(res) == 6) {
+3 -7
drivers/clocksource/sh_mtu2.c
··· 287 /* get hold of clock */ 288 p->clk = clk_get(&p->pdev->dev, "mtu2_fck"); 289 if (IS_ERR(p->clk)) { 290 - dev_warn(&p->pdev->dev, "using deprecated clock lookup\n"); 291 - p->clk = clk_get(&p->pdev->dev, cfg->clk); 292 - if (IS_ERR(p->clk)) { 293 - dev_err(&p->pdev->dev, "cannot get clock\n"); 294 - ret = PTR_ERR(p->clk); 295 - goto err1; 296 - } 297 } 298 299 return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
··· 287 /* get hold of clock */ 288 p->clk = clk_get(&p->pdev->dev, "mtu2_fck"); 289 if (IS_ERR(p->clk)) { 290 + dev_err(&p->pdev->dev, "cannot get clock\n"); 291 + ret = PTR_ERR(p->clk); 292 + goto err1; 293 } 294 295 return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
+3 -7
drivers/clocksource/sh_tmu.c
··· 393 /* get hold of clock */ 394 p->clk = clk_get(&p->pdev->dev, "tmu_fck"); 395 if (IS_ERR(p->clk)) { 396 - dev_warn(&p->pdev->dev, "using deprecated clock lookup\n"); 397 - p->clk = clk_get(&p->pdev->dev, cfg->clk); 398 - if (IS_ERR(p->clk)) { 399 - dev_err(&p->pdev->dev, "cannot get clock\n"); 400 - ret = PTR_ERR(p->clk); 401 - goto err1; 402 - } 403 } 404 405 return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
··· 393 /* get hold of clock */ 394 p->clk = clk_get(&p->pdev->dev, "tmu_fck"); 395 if (IS_ERR(p->clk)) { 396 + dev_err(&p->pdev->dev, "cannot get clock\n"); 397 + ret = PTR_ERR(p->clk); 398 + goto err1; 399 } 400 401 return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
+9 -9
include/linux/mmc/sh_mmcif.h
··· 59 #define MMCIF_CE_HOST_STS2 0x0000004C 60 #define MMCIF_CE_VERSION 0x0000007C 61 62 - extern inline u32 sh_mmcif_readl(void __iomem *addr, int reg) 63 { 64 return readl(addr + reg); 65 } 66 67 - extern inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val) 68 { 69 writel(val, addr + reg); 70 } 71 72 #define SH_MMCIF_BBS 512 /* boot block size */ 73 74 - extern inline void sh_mmcif_boot_cmd_send(void __iomem *base, 75 unsigned long cmd, unsigned long arg) 76 { 77 sh_mmcif_writel(base, MMCIF_CE_INT, 0); ··· 79 sh_mmcif_writel(base, MMCIF_CE_CMD_SET, cmd); 80 } 81 82 - extern inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask) 83 { 84 unsigned long tmp; 85 int cnt; ··· 95 return -1; 96 } 97 98 - extern inline int sh_mmcif_boot_cmd(void __iomem *base, 99 unsigned long cmd, unsigned long arg) 100 { 101 sh_mmcif_boot_cmd_send(base, cmd, arg); 102 return sh_mmcif_boot_cmd_poll(base, 0x00010000); 103 } 104 105 - extern inline int sh_mmcif_boot_do_read_single(void __iomem *base, 106 unsigned int block_nr, 107 unsigned long *buf) 108 { ··· 125 return 0; 126 } 127 128 - extern inline int sh_mmcif_boot_do_read(void __iomem *base, 129 unsigned long first_block, 130 unsigned long nr_blocks, 131 void *buf) ··· 143 return ret; 144 } 145 146 - extern inline void sh_mmcif_boot_init(void __iomem *base) 147 { 148 unsigned long tmp; 149 ··· 177 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000); 178 } 179 180 - extern inline void sh_mmcif_boot_slurp(void __iomem *base, 181 unsigned char *buf, 182 unsigned long no_bytes) 183 {
··· 59 #define MMCIF_CE_HOST_STS2 0x0000004C 60 #define MMCIF_CE_VERSION 0x0000007C 61 62 + static inline u32 sh_mmcif_readl(void __iomem *addr, int reg) 63 { 64 return readl(addr + reg); 65 } 66 67 + static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val) 68 { 69 writel(val, addr + reg); 70 } 71 72 #define SH_MMCIF_BBS 512 /* boot block size */ 73 74 + static inline void sh_mmcif_boot_cmd_send(void __iomem *base, 75 unsigned long cmd, unsigned long arg) 76 { 77 sh_mmcif_writel(base, MMCIF_CE_INT, 0); ··· 79 sh_mmcif_writel(base, MMCIF_CE_CMD_SET, cmd); 80 } 81 82 + static inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask) 83 { 84 unsigned long tmp; 85 int cnt; ··· 95 return -1; 96 } 97 98 + static inline int sh_mmcif_boot_cmd(void __iomem *base, 99 unsigned long cmd, unsigned long arg) 100 { 101 sh_mmcif_boot_cmd_send(base, cmd, arg); 102 return sh_mmcif_boot_cmd_poll(base, 0x00010000); 103 } 104 105 + static inline int sh_mmcif_boot_do_read_single(void __iomem *base, 106 unsigned int block_nr, 107 unsigned long *buf) 108 { ··· 125 return 0; 126 } 127 128 + static inline int sh_mmcif_boot_do_read(void __iomem *base, 129 unsigned long first_block, 130 unsigned long nr_blocks, 131 void *buf) ··· 143 return ret; 144 } 145 146 + static inline void sh_mmcif_boot_init(void __iomem *base) 147 { 148 unsigned long tmp; 149 ··· 177 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000); 178 } 179 180 + static inline void sh_mmcif_boot_slurp(void __iomem *base, 181 unsigned char *buf, 182 unsigned long no_bytes) 183 {
-1
include/linux/sh_timer.h
··· 5 char *name; 6 long channel_offset; 7 int timer_bit; 8 - char *clk; 9 unsigned long clockevent_rating; 10 unsigned long clocksource_rating; 11 };
··· 5 char *name; 6 long channel_offset; 7 int timer_bit; 8 unsigned long clockevent_rating; 9 unsigned long clocksource_rating; 10 };