diff options
author | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-07-31 09:56:36 -0400 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-08-08 06:44:01 -0400 |
commit | b47eb4092f81ae9fe406fa2c6719eaa9cd7a593c (patch) | |
tree | 3df392bb0440f3b04b169f8650464b6052076499 /arch/avr32/mach-at32ap/at32ap700x.c | |
parent | a8d902db221e1e2dcbbd32efbf89055ed69f8e56 (diff) |
avr32: Clean up HMATRIX code
Introduce a few helper functions for HMATRIX configuration and clean up
the register definitions. Also add definitions for the HMATRIX master
and slave IDs on the AT32AP700x chips.
Also make the definitions in hmatrix.h available to board code by moving
it to <mach/hmatrix.h>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap700x.c')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 92bfb4d8ae45..e01dbe4ebb40 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -22,13 +22,13 @@ | |||
22 | 22 | ||
23 | #include <mach/at32ap700x.h> | 23 | #include <mach/at32ap700x.h> |
24 | #include <mach/board.h> | 24 | #include <mach/board.h> |
25 | #include <mach/hmatrix.h> | ||
25 | #include <mach/portmux.h> | 26 | #include <mach/portmux.h> |
26 | #include <mach/sram.h> | 27 | #include <mach/sram.h> |
27 | 28 | ||
28 | #include <video/atmel_lcdc.h> | 29 | #include <video/atmel_lcdc.h> |
29 | 30 | ||
30 | #include "clock.h" | 31 | #include "clock.h" |
31 | #include "hmatrix.h" | ||
32 | #include "pio.h" | 32 | #include "pio.h" |
33 | #include "pm.h" | 33 | #include "pm.h" |
34 | 34 | ||
@@ -725,7 +725,7 @@ static struct clk pico_clk = { | |||
725 | * HMATRIX | 725 | * HMATRIX |
726 | * -------------------------------------------------------------------- */ | 726 | * -------------------------------------------------------------------- */ |
727 | 727 | ||
728 | static struct clk hmatrix_clk = { | 728 | struct clk at32_hmatrix_clk = { |
729 | .name = "hmatrix_clk", | 729 | .name = "hmatrix_clk", |
730 | .parent = &pbb_clk, | 730 | .parent = &pbb_clk, |
731 | .mode = pbb_clk_mode, | 731 | .mode = pbb_clk_mode, |
@@ -733,12 +733,6 @@ static struct clk hmatrix_clk = { | |||
733 | .index = 2, | 733 | .index = 2, |
734 | .users = 1, | 734 | .users = 1, |
735 | }; | 735 | }; |
736 | #define HMATRIX_BASE ((void __iomem *)0xfff00800) | ||
737 | |||
738 | #define hmatrix_readl(reg) \ | ||
739 | __raw_readl((HMATRIX_BASE) + HMATRIX_##reg) | ||
740 | #define hmatrix_writel(reg,value) \ | ||
741 | __raw_writel((value), (HMATRIX_BASE) + HMATRIX_##reg) | ||
742 | 736 | ||
743 | /* | 737 | /* |
744 | * Set bits in the HMATRIX Special Function Register (SFR) used by the | 738 | * Set bits in the HMATRIX Special Function Register (SFR) used by the |
@@ -748,13 +742,7 @@ static struct clk hmatrix_clk = { | |||
748 | */ | 742 | */ |
749 | static inline void set_ebi_sfr_bits(u32 mask) | 743 | static inline void set_ebi_sfr_bits(u32 mask) |
750 | { | 744 | { |
751 | u32 sfr; | 745 | hmatrix_sfr_set_bits(HMATRIX_SLAVE_EBI, mask); |
752 | |||
753 | clk_enable(&hmatrix_clk); | ||
754 | sfr = hmatrix_readl(SFR4); | ||
755 | sfr |= mask; | ||
756 | hmatrix_writel(SFR4, sfr); | ||
757 | clk_disable(&hmatrix_clk); | ||
758 | } | 746 | } |
759 | 747 | ||
760 | /* -------------------------------------------------------------------- | 748 | /* -------------------------------------------------------------------- |
@@ -1779,7 +1767,7 @@ static int __init at32_init_ide_or_cf(struct platform_device *pdev, | |||
1779 | return ret; | 1767 | return ret; |
1780 | 1768 | ||
1781 | select_peripheral(PE(21), PERIPH_A, 0); /* NCS4 -> OE_N */ | 1769 | select_peripheral(PE(21), PERIPH_A, 0); /* NCS4 -> OE_N */ |
1782 | set_ebi_sfr_bits(HMATRIX_BIT(CS4A)); | 1770 | hmatrix_sfr_set_bits(HMATRIX_SLAVE_EBI, HMATRIX_EBI_CF0_ENABLE); |
1783 | break; | 1771 | break; |
1784 | case 5: | 1772 | case 5: |
1785 | ret = platform_device_add_resources(pdev, | 1773 | ret = platform_device_add_resources(pdev, |
@@ -1789,7 +1777,7 @@ static int __init at32_init_ide_or_cf(struct platform_device *pdev, | |||
1789 | return ret; | 1777 | return ret; |
1790 | 1778 | ||
1791 | select_peripheral(PE(22), PERIPH_A, 0); /* NCS5 -> OE_N */ | 1779 | select_peripheral(PE(22), PERIPH_A, 0); /* NCS5 -> OE_N */ |
1792 | set_ebi_sfr_bits(HMATRIX_BIT(CS5A)); | 1780 | hmatrix_sfr_set_bits(HMATRIX_SLAVE_EBI, HMATRIX_EBI_CF1_ENABLE); |
1793 | break; | 1781 | break; |
1794 | default: | 1782 | default: |
1795 | return -EINVAL; | 1783 | return -EINVAL; |
@@ -1905,7 +1893,7 @@ at32_add_device_nand(unsigned int id, struct atmel_nand_data *data) | |||
1905 | sizeof(struct atmel_nand_data))) | 1893 | sizeof(struct atmel_nand_data))) |
1906 | goto fail; | 1894 | goto fail; |
1907 | 1895 | ||
1908 | set_ebi_sfr_bits(HMATRIX_BIT(CS3A)); | 1896 | hmatrix_sfr_set_bits(HMATRIX_SLAVE_EBI, HMATRIX_EBI_NAND_ENABLE); |
1909 | if (data->enable_pin) | 1897 | if (data->enable_pin) |
1910 | at32_select_gpio(data->enable_pin, | 1898 | at32_select_gpio(data->enable_pin, |
1911 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | 1899 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); |
@@ -2097,7 +2085,7 @@ struct clk *at32_clock_list[] = { | |||
2097 | &pbb_clk, | 2085 | &pbb_clk, |
2098 | &at32_pm_pclk, | 2086 | &at32_pm_pclk, |
2099 | &at32_intc0_pclk, | 2087 | &at32_intc0_pclk, |
2100 | &hmatrix_clk, | 2088 | &at32_hmatrix_clk, |
2101 | &ebi_clk, | 2089 | &ebi_clk, |
2102 | &hramc_clk, | 2090 | &hramc_clk, |
2103 | &sdramc_clk, | 2091 | &sdramc_clk, |