Commit df9d38eb authored by Linus Torvalds's avatar Linus Torvalds

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

* 'sh-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
  sh: se/7724: Remove FSI/B of GPIO init code
  sh: se/7724: Update clock framework of FSI clock to non-legacy
  sh: Assume new page cache pages have dirty dcache lines.
  sh: boards: mach-se: use IS_ERR() instead of NULL check
  sh: Add div6_reparent_clks to clock framework for FSI
  dma: shdma: add a MODULE_ALIAS() to allow module autoloading
parents 47337ad6 a9fc7492
...@@ -720,32 +720,6 @@ static struct platform_device camera_devices[] = { ...@@ -720,32 +720,6 @@ static struct platform_device camera_devices[] = {
}; };
/* FSI */ /* FSI */
/*
* FSI-B use external clock which came from da7210.
* So, we should change parent of fsi
*/
#define FCLKBCR 0xa415000c
static void fsimck_init(struct clk *clk)
{
u32 status = __raw_readl(clk->enable_reg);
/* use external clock */
status &= ~0x000000ff;
status |= 0x00000080;
__raw_writel(status, clk->enable_reg);
}
static struct clk_ops fsimck_clk_ops = {
.init = fsimck_init,
};
static struct clk fsimckb_clk = {
.ops = &fsimck_clk_ops,
.enable_reg = (void __iomem *)FCLKBCR,
.rate = 0, /* unknown */
};
static struct sh_fsi_platform_info fsi_info = { static struct sh_fsi_platform_info fsi_info = {
.portb_flags = SH_FSI_BRS_INV | .portb_flags = SH_FSI_BRS_INV |
SH_FSI_OUT_SLAVE_MODE | SH_FSI_OUT_SLAVE_MODE |
...@@ -1264,10 +1238,10 @@ static int __init arch_setup(void) ...@@ -1264,10 +1238,10 @@ static int __init arch_setup(void)
/* change parent of FSI B */ /* change parent of FSI B */
clk = clk_get(NULL, "fsib_clk"); clk = clk_get(NULL, "fsib_clk");
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
clk_register(&fsimckb_clk); /* 48kHz dummy clock was used to make sure 1/1 divide */
clk_set_parent(clk, &fsimckb_clk); clk_set_rate(&sh7724_fsimckb_clk, 48000);
clk_set_rate(clk, 11000); clk_set_parent(clk, &sh7724_fsimckb_clk);
clk_set_rate(&fsimckb_clk, 11000); clk_set_rate(clk, 48000);
clk_put(clk); clk_put(clk);
} }
......
...@@ -283,31 +283,6 @@ static struct platform_device ceu1_device = { ...@@ -283,31 +283,6 @@ static struct platform_device ceu1_device = {
}; };
/* FSI */ /* FSI */
/*
* FSI-A use external clock which came from ak464x.
* So, we should change parent of fsi
*/
#define FCLKACR 0xa4150008
static void fsimck_init(struct clk *clk)
{
u32 status = __raw_readl(clk->enable_reg);
/* use external clock */
status &= ~0x000000ff;
status |= 0x00000080;
__raw_writel(status, clk->enable_reg);
}
static struct clk_ops fsimck_clk_ops = {
.init = fsimck_init,
};
static struct clk fsimcka_clk = {
.ops = &fsimck_clk_ops,
.enable_reg = (void __iomem *)FCLKACR,
.rate = 0, /* unknown */
};
/* change J20, J21, J22 pin to 1-2 connection to use slave mode */ /* change J20, J21, J22 pin to 1-2 connection to use slave mode */
static struct sh_fsi_platform_info fsi_info = { static struct sh_fsi_platform_info fsi_info = {
.porta_flags = SH_FSI_BRS_INV | .porta_flags = SH_FSI_BRS_INV |
...@@ -852,37 +827,29 @@ static int __init devices_setup(void) ...@@ -852,37 +827,29 @@ static int __init devices_setup(void)
gpio_request(GPIO_FN_KEYOUT0, NULL); gpio_request(GPIO_FN_KEYOUT0, NULL);
/* enable FSI */ /* enable FSI */
gpio_request(GPIO_FN_FSIMCKB, NULL);
gpio_request(GPIO_FN_FSIMCKA, NULL); gpio_request(GPIO_FN_FSIMCKA, NULL);
gpio_request(GPIO_FN_FSIIASD, NULL);
gpio_request(GPIO_FN_FSIOASD, NULL); gpio_request(GPIO_FN_FSIOASD, NULL);
gpio_request(GPIO_FN_FSIIABCK, NULL); gpio_request(GPIO_FN_FSIIABCK, NULL);
gpio_request(GPIO_FN_FSIIALRCK, NULL); gpio_request(GPIO_FN_FSIIALRCK, NULL);
gpio_request(GPIO_FN_FSIOABCK, NULL); gpio_request(GPIO_FN_FSIOABCK, NULL);
gpio_request(GPIO_FN_FSIOALRCK, NULL); gpio_request(GPIO_FN_FSIOALRCK, NULL);
gpio_request(GPIO_FN_CLKAUDIOAO, NULL); gpio_request(GPIO_FN_CLKAUDIOAO, NULL);
gpio_request(GPIO_FN_FSIIBSD, NULL);
gpio_request(GPIO_FN_FSIOBSD, NULL);
gpio_request(GPIO_FN_FSIIBBCK, NULL);
gpio_request(GPIO_FN_FSIIBLRCK, NULL);
gpio_request(GPIO_FN_FSIOBBCK, NULL);
gpio_request(GPIO_FN_FSIOBLRCK, NULL);
gpio_request(GPIO_FN_CLKAUDIOBO, NULL);
gpio_request(GPIO_FN_FSIIASD, NULL);
/* set SPU2 clock to 83.4 MHz */ /* set SPU2 clock to 83.4 MHz */
clk = clk_get(NULL, "spu_clk"); clk = clk_get(NULL, "spu_clk");
if (clk) { if (!IS_ERR(clk)) {
clk_set_rate(clk, clk_round_rate(clk, 83333333)); clk_set_rate(clk, clk_round_rate(clk, 83333333));
clk_put(clk); clk_put(clk);
} }
/* change parent of FSI A */ /* change parent of FSI A */
clk = clk_get(NULL, "fsia_clk"); clk = clk_get(NULL, "fsia_clk");
if (clk) { if (!IS_ERR(clk)) {
clk_register(&fsimcka_clk); /* 48kHz dummy clock was used to make sure 1/1 divide */
clk_set_parent(clk, &fsimcka_clk); clk_set_rate(&sh7724_fsimcka_clk, 48000);
clk_set_rate(clk, 11000); clk_set_parent(clk, &sh7724_fsimcka_clk);
clk_set_rate(&fsimcka_clk, 11000); clk_set_rate(clk, 48000);
clk_put(clk); clk_put(clk);
} }
......
...@@ -96,7 +96,7 @@ void kmap_coherent_init(void); ...@@ -96,7 +96,7 @@ void kmap_coherent_init(void);
void *kmap_coherent(struct page *page, unsigned long addr); void *kmap_coherent(struct page *page, unsigned long addr);
void kunmap_coherent(void *kvaddr); void kunmap_coherent(void *kvaddr);
#define PG_dcache_dirty PG_arch_1 #define PG_dcache_clean PG_arch_1
void cpu_cache_init(void); void cpu_cache_init(void);
......
...@@ -303,4 +303,7 @@ enum { ...@@ -303,4 +303,7 @@ enum {
SHDMA_SLAVE_SDHI1_RX, SHDMA_SLAVE_SDHI1_RX,
}; };
extern struct clk sh7724_fsimcka_clk;
extern struct clk sh7724_fsimckb_clk;
#endif /* __ASM_SH7724_H__ */ #endif /* __ASM_SH7724_H__ */
...@@ -111,12 +111,21 @@ static struct clk div3_clk = { ...@@ -111,12 +111,21 @@ static struct clk div3_clk = {
.parent = &pll_clk, .parent = &pll_clk,
}; };
/* External input clock (pin name: FSIMCKA/FSIMCKB ) */
struct clk sh7724_fsimcka_clk = {
};
struct clk sh7724_fsimckb_clk = {
};
static struct clk *main_clks[] = { static struct clk *main_clks[] = {
&r_clk, &r_clk,
&extal_clk, &extal_clk,
&fll_clk, &fll_clk,
&pll_clk, &pll_clk,
&div3_clk, &div3_clk,
&sh7724_fsimcka_clk,
&sh7724_fsimckb_clk,
}; };
static void div4_kick(struct clk *clk) static void div4_kick(struct clk *clk)
...@@ -154,16 +163,38 @@ struct clk div4_clks[DIV4_NR] = { ...@@ -154,16 +163,38 @@ struct clk div4_clks[DIV4_NR] = {
[DIV4_M1] = DIV4(FRQCRB, 4, 0x2f7c, CLK_ENABLE_ON_INIT), [DIV4_M1] = DIV4(FRQCRB, 4, 0x2f7c, CLK_ENABLE_ON_INIT),
}; };
enum { DIV6_V, DIV6_FA, DIV6_FB, DIV6_I, DIV6_S, DIV6_NR }; enum { DIV6_V, DIV6_I, DIV6_S, DIV6_NR };
static struct clk div6_clks[DIV6_NR] = { static struct clk div6_clks[DIV6_NR] = {
[DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0), [DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0),
[DIV6_FA] = SH_CLK_DIV6(&div3_clk, FCLKACR, 0),
[DIV6_FB] = SH_CLK_DIV6(&div3_clk, FCLKBCR, 0),
[DIV6_I] = SH_CLK_DIV6(&div3_clk, IRDACLKCR, 0), [DIV6_I] = SH_CLK_DIV6(&div3_clk, IRDACLKCR, 0),
[DIV6_S] = SH_CLK_DIV6(&div3_clk, SPUCLKCR, CLK_ENABLE_ON_INIT), [DIV6_S] = SH_CLK_DIV6(&div3_clk, SPUCLKCR, CLK_ENABLE_ON_INIT),
}; };
enum { DIV6_FA, DIV6_FB, DIV6_REPARENT_NR };
/* Indices are important - they are the actual src selecting values */
static struct clk *fclkacr_parent[] = {
[0] = &div3_clk,
[1] = NULL,
[2] = &sh7724_fsimcka_clk,
[3] = NULL,
};
static struct clk *fclkbcr_parent[] = {
[0] = &div3_clk,
[1] = NULL,
[2] = &sh7724_fsimckb_clk,
[3] = NULL,
};
static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
[DIV6_FA] = SH_CLK_DIV6_EXT(&div3_clk, FCLKACR, 0,
fclkacr_parent, ARRAY_SIZE(fclkacr_parent), 6, 2),
[DIV6_FB] = SH_CLK_DIV6_EXT(&div3_clk, FCLKBCR, 0,
fclkbcr_parent, ARRAY_SIZE(fclkbcr_parent), 6, 2),
};
static struct clk mstp_clks[HWBLK_NR] = { static struct clk mstp_clks[HWBLK_NR] = {
SH_HWBLK_CLK(HWBLK_TLB, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT), SH_HWBLK_CLK(HWBLK_TLB, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
SH_HWBLK_CLK(HWBLK_IC, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT), SH_HWBLK_CLK(HWBLK_IC, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
...@@ -240,8 +271,8 @@ static struct clk_lookup lookups[] = { ...@@ -240,8 +271,8 @@ static struct clk_lookup lookups[] = {
/* DIV6 clocks */ /* DIV6 clocks */
CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]), CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]),
CLKDEV_CON_ID("fsia_clk", &div6_clks[DIV6_FA]), CLKDEV_CON_ID("fsia_clk", &div6_reparent_clks[DIV6_FA]),
CLKDEV_CON_ID("fsib_clk", &div6_clks[DIV6_FB]), CLKDEV_CON_ID("fsib_clk", &div6_reparent_clks[DIV6_FB]),
CLKDEV_CON_ID("irda_clk", &div6_clks[DIV6_I]), CLKDEV_CON_ID("irda_clk", &div6_clks[DIV6_I]),
CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_S]), CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_S]),
...@@ -375,6 +406,9 @@ int __init arch_clk_init(void) ...@@ -375,6 +406,9 @@ int __init arch_clk_init(void)
if (!ret) if (!ret)
ret = sh_clk_div6_register(div6_clks, DIV6_NR); ret = sh_clk_div6_register(div6_clks, DIV6_NR);
if (!ret)
ret = sh_clk_div6_reparent_register(div6_reparent_clks, DIV6_REPARENT_NR);
if (!ret) if (!ret)
ret = sh_hwblk_clk_register(mstp_clks, HWBLK_NR); ret = sh_hwblk_clk_register(mstp_clks, HWBLK_NR);
......
...@@ -114,7 +114,7 @@ static void sh4_flush_dcache_page(void *arg) ...@@ -114,7 +114,7 @@ static void sh4_flush_dcache_page(void *arg)
struct address_space *mapping = page_mapping(page); struct address_space *mapping = page_mapping(page);
if (mapping && !mapping_mapped(mapping)) if (mapping && !mapping_mapped(mapping))
set_bit(PG_dcache_dirty, &page->flags); clear_bit(PG_dcache_clean, &page->flags);
else else
#endif #endif
flush_cache_one(CACHE_OC_ADDRESS_ARRAY | flush_cache_one(CACHE_OC_ADDRESS_ARRAY |
...@@ -239,7 +239,7 @@ static void sh4_flush_cache_page(void *args) ...@@ -239,7 +239,7 @@ static void sh4_flush_cache_page(void *args)
* another ASID than the current one. * another ASID than the current one.
*/ */
map_coherent = (current_cpu_data.dcache.n_aliases && map_coherent = (current_cpu_data.dcache.n_aliases &&
!test_bit(PG_dcache_dirty, &page->flags) && test_bit(PG_dcache_clean, &page->flags) &&
page_mapped(page)); page_mapped(page));
if (map_coherent) if (map_coherent)
vaddr = kmap_coherent(page, address); vaddr = kmap_coherent(page, address);
......
...@@ -139,7 +139,7 @@ static void sh7705_flush_dcache_page(void *arg) ...@@ -139,7 +139,7 @@ static void sh7705_flush_dcache_page(void *arg)
struct address_space *mapping = page_mapping(page); struct address_space *mapping = page_mapping(page);
if (mapping && !mapping_mapped(mapping)) if (mapping && !mapping_mapped(mapping))
set_bit(PG_dcache_dirty, &page->flags); clear_bit(PG_dcache_clean, &page->flags);
else else
__flush_dcache_page(__pa(page_address(page))); __flush_dcache_page(__pa(page_address(page)));
} }
......
...@@ -60,14 +60,14 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page, ...@@ -60,14 +60,14 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
unsigned long len) unsigned long len)
{ {
if (boot_cpu_data.dcache.n_aliases && page_mapped(page) && if (boot_cpu_data.dcache.n_aliases && page_mapped(page) &&
!test_bit(PG_dcache_dirty, &page->flags)) { test_bit(PG_dcache_clean, &page->flags)) {
void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
memcpy(vto, src, len); memcpy(vto, src, len);
kunmap_coherent(vto); kunmap_coherent(vto);
} else { } else {
memcpy(dst, src, len); memcpy(dst, src, len);
if (boot_cpu_data.dcache.n_aliases) if (boot_cpu_data.dcache.n_aliases)
set_bit(PG_dcache_dirty, &page->flags); clear_bit(PG_dcache_clean, &page->flags);
} }
if (vma->vm_flags & VM_EXEC) if (vma->vm_flags & VM_EXEC)
...@@ -79,14 +79,14 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page, ...@@ -79,14 +79,14 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
unsigned long len) unsigned long len)
{ {
if (boot_cpu_data.dcache.n_aliases && page_mapped(page) && if (boot_cpu_data.dcache.n_aliases && page_mapped(page) &&
!test_bit(PG_dcache_dirty, &page->flags)) { test_bit(PG_dcache_clean, &page->flags)) {
void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
memcpy(dst, vfrom, len); memcpy(dst, vfrom, len);
kunmap_coherent(vfrom); kunmap_coherent(vfrom);
} else { } else {
memcpy(dst, src, len); memcpy(dst, src, len);
if (boot_cpu_data.dcache.n_aliases) if (boot_cpu_data.dcache.n_aliases)
set_bit(PG_dcache_dirty, &page->flags); clear_bit(PG_dcache_clean, &page->flags);
} }
} }
...@@ -98,7 +98,7 @@ void copy_user_highpage(struct page *to, struct page *from, ...@@ -98,7 +98,7 @@ void copy_user_highpage(struct page *to, struct page *from,
vto = kmap_atomic(to, KM_USER1); vto = kmap_atomic(to, KM_USER1);
if (boot_cpu_data.dcache.n_aliases && page_mapped(from) && if (boot_cpu_data.dcache.n_aliases && page_mapped(from) &&
!test_bit(PG_dcache_dirty, &from->flags)) { test_bit(PG_dcache_clean, &from->flags)) {
vfrom = kmap_coherent(from, vaddr); vfrom = kmap_coherent(from, vaddr);
copy_page(vto, vfrom); copy_page(vto, vfrom);
kunmap_coherent(vfrom); kunmap_coherent(vfrom);
...@@ -141,7 +141,7 @@ void __update_cache(struct vm_area_struct *vma, ...@@ -141,7 +141,7 @@ void __update_cache(struct vm_area_struct *vma,
page = pfn_to_page(pfn); page = pfn_to_page(pfn);
if (pfn_valid(pfn)) { if (pfn_valid(pfn)) {
int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); int dirty = !test_and_set_bit(PG_dcache_clean, &page->flags);
if (dirty) if (dirty)
__flush_purge_region(page_address(page), PAGE_SIZE); __flush_purge_region(page_address(page), PAGE_SIZE);
} }
...@@ -153,7 +153,7 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr) ...@@ -153,7 +153,7 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr)
if (pages_do_alias(addr, vmaddr)) { if (pages_do_alias(addr, vmaddr)) {
if (boot_cpu_data.dcache.n_aliases && page_mapped(page) && if (boot_cpu_data.dcache.n_aliases && page_mapped(page) &&
!test_bit(PG_dcache_dirty, &page->flags)) { test_bit(PG_dcache_clean, &page->flags)) {
void *kaddr; void *kaddr;
kaddr = kmap_coherent(page, vmaddr); kaddr = kmap_coherent(page, vmaddr);
......
...@@ -34,7 +34,7 @@ void *kmap_coherent(struct page *page, unsigned long addr) ...@@ -34,7 +34,7 @@ void *kmap_coherent(struct page *page, unsigned long addr)
enum fixed_addresses idx; enum fixed_addresses idx;
unsigned long vaddr; unsigned long vaddr;
BUG_ON(test_bit(PG_dcache_dirty, &page->flags)); BUG_ON(!test_bit(PG_dcache_clean, &page->flags));
pagefault_disable(); pagefault_disable();
......
...@@ -1213,3 +1213,4 @@ module_exit(sh_dmae_exit); ...@@ -1213,3 +1213,4 @@ module_exit(sh_dmae_exit);
MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>"); MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>");
MODULE_DESCRIPTION("Renesas SH DMA Engine driver"); MODULE_DESCRIPTION("Renesas SH DMA Engine driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:sh-dma-engine");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment