aboutsummaryrefslogtreecommitdiff
path: root/arch/avr32
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32')
-rw-r--r--arch/avr32/kernel/ocd.c18
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c54
2 files changed, 65 insertions, 7 deletions
diff --git a/arch/avr32/kernel/ocd.c b/arch/avr32/kernel/ocd.c
index c4f023294d7..1b0245d4e0c 100644
--- a/arch/avr32/kernel/ocd.c
+++ b/arch/avr32/kernel/ocd.c
@@ -90,25 +90,29 @@ static struct dentry *ocd_debugfs_DC;
static struct dentry *ocd_debugfs_DS;
static struct dentry *ocd_debugfs_count;
-static u64 ocd_DC_get(void *data)
+static int ocd_DC_get(void *data, u64 *val)
{
- return ocd_read(DC);
+ *val = ocd_read(DC);
+ return 0;
}
-static void ocd_DC_set(void *data, u64 val)
+static int ocd_DC_set(void *data, u64 val)
{
ocd_write(DC, val);
+ return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(fops_DC, ocd_DC_get, ocd_DC_set, "0x%08llx\n");
-static u64 ocd_DS_get(void *data)
+static int ocd_DS_get(void *data, u64 *val)
{
- return ocd_read(DS);
+ *val = ocd_read(DS);
+ return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(fops_DS, ocd_DS_get, NULL, "0x%08llx\n");
-static u64 ocd_count_get(void *data)
+static int ocd_count_get(void *data, u64 *val)
{
- return ocd_count;
+ *val = ocd_count;
+ return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(fops_count, ocd_count_get, NULL, "%lld\n");
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 14e61f05e1f..7678fee9a88 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1186,6 +1186,59 @@ err_dup_modedb:
#endif
/* --------------------------------------------------------------------
+ * PWM
+ * -------------------------------------------------------------------- */
+static struct resource atmel_pwm0_resource[] __initdata = {
+ PBMEM(0xfff01400),
+ IRQ(24),
+};
+static struct clk atmel_pwm0_mck = {
+ .name = "mck",
+ .parent = &pbb_clk,
+ .mode = pbb_clk_mode,
+ .get_rate = pbb_clk_get_rate,
+ .index = 5,
+};
+
+struct platform_device *__init at32_add_device_pwm(u32 mask)
+{
+ struct platform_device *pdev;
+
+ if (!mask)
+ return NULL;
+
+ pdev = platform_device_alloc("atmel_pwm", 0);
+ if (!pdev)
+ return NULL;
+
+ if (platform_device_add_resources(pdev, atmel_pwm0_resource,
+ ARRAY_SIZE(atmel_pwm0_resource)))
+ goto out_free_pdev;
+
+ if (platform_device_add_data(pdev, &mask, sizeof(mask)))
+ goto out_free_pdev;
+
+ if (mask & (1 << 0))
+ select_peripheral(PA(28), PERIPH_A, 0);
+ if (mask & (1 << 1))
+ select_peripheral(PA(29), PERIPH_A, 0);
+ if (mask & (1 << 2))
+ select_peripheral(PA(21), PERIPH_B, 0);
+ if (mask & (1 << 3))
+ select_peripheral(PA(22), PERIPH_B, 0);
+
+ atmel_pwm0_mck.dev = &pdev->dev;
+
+ platform_device_add(pdev);
+
+ return pdev;
+
+out_free_pdev:
+ platform_device_put(pdev);
+ return NULL;
+}
+
+/* --------------------------------------------------------------------
* SSC
* -------------------------------------------------------------------- */
static struct resource ssc0_resource[] = {
@@ -1646,6 +1699,7 @@ struct clk *at32_clock_list[] = {
&atmel_usart1_usart,
&atmel_usart2_usart,
&atmel_usart3_usart,
+ &atmel_pwm0_mck,
#if defined(CONFIG_CPU_AT32AP7000)
&macb0_hclk,
&macb0_pclk,