]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Merge branch 'rmobile/dma' into rmobile-fixes-for-linus
authorPaul Mundt <lethal@linux-sh.org>
Mon, 29 Aug 2011 07:10:24 +0000 (16:10 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 29 Aug 2011 07:10:24 +0000 (16:10 +0900)
1  2 
arch/arm/mach-shmobile/clock-sh7372.c
arch/arm/mach-shmobile/include/mach/sh7372.h
arch/arm/mach-shmobile/setup-sh7372.c

index dc8c899aa5eb4aa0b70982bc64bae54498d30522,c239ab10c95b25bd5ee67041b502ac6a608c5417..5309544957b7e775b0ad3b927aa4022363172264
@@@ -509,10 -509,10 +509,10 @@@ enum { MSTP001
         MSTP118, MSTP117, MSTP116, MSTP113,
         MSTP106, MSTP101, MSTP100,
         MSTP223,
-        MSTP218, MSTP217, MSTP216,
+        MSTP214, MSTP218, MSTP217, MSTP216,
         MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
 -       MSTP329, MSTP328, MSTP323, MSTP322, MSTP314, MSTP313, MSTP312,
 -       MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP406, MSTP403,
 +       MSTP328, MSTP323, MSTP322, MSTP314, MSTP313, MSTP312,
 +       MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP406, MSTP403, MSTP400,
         MSTP_NR };
  
  #define MSTP(_parent, _reg, _bit, _flags) \
@@@ -538,6 -538,7 +538,7 @@@ static struct clk mstp_clks[MSTP_NR] = 
        [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */
        [MSTP217] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */
        [MSTP216] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 16, 0), /* DMAC3 */
+       [MSTP214] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 14, 0), /* USBDMAC */
        [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */
        [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */
        [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */
        [MSTP202] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 2, 0), /* SCIFA2 */
        [MSTP201] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */
        [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */
 -      [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
        [MSTP328] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR3, 28, 0), /* FSI2 */
        [MSTP323] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */
        [MSTP322] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 22, 0), /* USB0 */
        [MSTP410] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 10, 0), /* IIC4 */
        [MSTP406] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 6, 0), /* USB1 */
        [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
 +      [MSTP400] = MSTP(&r_clk, SMSTPCR4, 0, 0), /* CMT2 */
  };
  
 -#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
 -#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
 -#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
 -
  static struct clk_lookup lookups[] = {
        /* main clocks */
        CLKDEV_CON_ID("dv_clki_div2_clk", &sh7372_dv_clki_div2_clk),
        CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* DMAC1 */
        CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), /* DMAC2 */
        CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), /* DMAC3 */
+       CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]), /* USB-DMAC0 */
+       CLKDEV_DEV_ID("sh-dma-engine.4", &mstp_clks[MSTP214]), /* USB-DMAC1 */
        CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
        CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP206]), /* SCIFB */
        CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
        CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */
        CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
        CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
 -      CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
        CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI2 */
        CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */
        CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USB0 */
        CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */
        CLKDEV_DEV_ID("renesas_usbhs.1", &mstp_clks[MSTP406]), /* USB1 */
        CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
 +      CLKDEV_DEV_ID("sh_cmt.2", &mstp_clks[MSTP400]), /* CMT2 */
  
        CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]),
        CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]),
        CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]),
 +      CLKDEV_ICK_ID("spu2", "sh_fsi2", &mstp_clks[MSTP223]),
  };
  
  void __init sh7372_clock_init(void)
index ce595cee86cd50e313984131ab5329578b98612d,51db9d3a2cac0dd615c5cfe93566362ad9563fcc..24e63a85e6699a51660352601ca8d378e0570f36
@@@ -12,7 -12,6 +12,7 @@@
  #define __ASM_SH7372_H__
  
  #include <linux/sh_clk.h>
 +#include <linux/pm_domain.h>
  
  /*
   * Pin Function Controller:
@@@ -459,6 -458,10 +459,10 @@@ enum 
        SHDMA_SLAVE_SDHI2_TX,
        SHDMA_SLAVE_MMCIF_RX,
        SHDMA_SLAVE_MMCIF_TX,
+       SHDMA_SLAVE_USB0_TX,
+       SHDMA_SLAVE_USB0_RX,
+       SHDMA_SLAVE_USB1_TX,
+       SHDMA_SLAVE_USB1_RX,
  };
  
  extern struct clk sh7372_extal1_clk;
@@@ -471,32 -474,4 +475,32 @@@ extern struct clk sh7372_fsibck_clk
  extern struct clk sh7372_fsidiva_clk;
  extern struct clk sh7372_fsidivb_clk;
  
 +struct platform_device;
 +
 +struct sh7372_pm_domain {
 +      struct generic_pm_domain genpd;
 +      unsigned int bit_shift;
 +};
 +
 +static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d)
 +{
 +      return container_of(d, struct sh7372_pm_domain, genpd);
 +}
 +
 +#ifdef CONFIG_PM
 +extern struct sh7372_pm_domain sh7372_a4lc;
 +extern struct sh7372_pm_domain sh7372_a4mp;
 +extern struct sh7372_pm_domain sh7372_d4;
 +extern struct sh7372_pm_domain sh7372_a3rv;
 +extern struct sh7372_pm_domain sh7372_a3ri;
 +extern struct sh7372_pm_domain sh7372_a3sg;
 +
 +extern void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd);
 +extern void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd,
 +                                      struct platform_device *pdev);
 +#else
 +#define sh7372_init_pm_domain(pd) do { } while(0)
 +#define sh7372_add_device_to_domain(pd, pdev) do { } while(0)
 +#endif /* CONFIG_PM */
 +
  #endif /* __ASM_SH7372_H__ */
index d17d0d2ba5ebe056540a391ec23040d1430cf9c9,f2a58d48bfb4d3d1ae7c10b79a1647ef52408843..2d9b1b1a25387fe1b4605663a5dc2a9135c6f5a5
@@@ -169,35 -169,35 +169,35 @@@ static struct platform_device scif6_dev
  };
  
  /* CMT */
 -static struct sh_timer_config cmt10_platform_data = {
 -      .name = "CMT10",
 -      .channel_offset = 0x10,
 -      .timer_bit = 0,
 +static struct sh_timer_config cmt2_platform_data = {
 +      .name = "CMT2",
 +      .channel_offset = 0x40,
 +      .timer_bit = 5,
        .clockevent_rating = 125,
        .clocksource_rating = 125,
  };
  
 -static struct resource cmt10_resources[] = {
 +static struct resource cmt2_resources[] = {
        [0] = {
 -              .name   = "CMT10",
 -              .start  = 0xe6138010,
 -              .end    = 0xe613801b,
 +              .name   = "CMT2",
 +              .start  = 0xe6130040,
 +              .end    = 0xe613004b,
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
 -              .start  = evt2irq(0x0b00), /* CMT1_CMT10 */
 +              .start  = evt2irq(0x0b80), /* CMT2 */
                .flags  = IORESOURCE_IRQ,
        },
  };
  
 -static struct platform_device cmt10_device = {
 +static struct platform_device cmt2_device = {
        .name           = "sh_cmt",
 -      .id             = 10,
 +      .id             = 2,
        .dev = {
 -              .platform_data  = &cmt10_platform_data,
 +              .platform_data  = &cmt2_platform_data,
        },
 -      .resource       = cmt10_resources,
 -      .num_resources  = ARRAY_SIZE(cmt10_resources),
 +      .resource       = cmt2_resources,
 +      .num_resources  = ARRAY_SIZE(cmt2_resources),
  };
  
  /* TMU */
@@@ -602,6 -602,150 +602,150 @@@ static struct platform_device dma2_devi
        },
  };
  
+ /*
+  * USB-DMAC
+  */
+ unsigned int usbts_shift[] = {3, 4, 5};
+ enum {
+       XMIT_SZ_8BYTE           = 0,
+       XMIT_SZ_16BYTE          = 1,
+       XMIT_SZ_32BYTE          = 2,
+ };
+ #define USBTS_INDEX2VAL(i) (((i) & 3) << 6)
+ static const struct sh_dmae_channel sh7372_usb_dmae_channels[] = {
+       {
+               .offset = 0,
+       }, {
+               .offset = 0x20,
+       },
+ };
+ /* USB DMAC0 */
+ static const struct sh_dmae_slave_config sh7372_usb_dmae0_slaves[] = {
+       {
+               .slave_id       = SHDMA_SLAVE_USB0_TX,
+               .chcr           = USBTS_INDEX2VAL(XMIT_SZ_8BYTE),
+       }, {
+               .slave_id       = SHDMA_SLAVE_USB0_RX,
+               .chcr           = USBTS_INDEX2VAL(XMIT_SZ_8BYTE),
+       },
+ };
+ static struct sh_dmae_pdata usb_dma0_platform_data = {
+       .slave          = sh7372_usb_dmae0_slaves,
+       .slave_num      = ARRAY_SIZE(sh7372_usb_dmae0_slaves),
+       .channel        = sh7372_usb_dmae_channels,
+       .channel_num    = ARRAY_SIZE(sh7372_usb_dmae_channels),
+       .ts_low_shift   = 6,
+       .ts_low_mask    = 0xc0,
+       .ts_high_shift  = 0,
+       .ts_high_mask   = 0,
+       .ts_shift       = usbts_shift,
+       .ts_shift_num   = ARRAY_SIZE(usbts_shift),
+       .dmaor_init     = DMAOR_DME,
+       .chcr_offset    = 0x14,
+       .chcr_ie_bit    = 1 << 5,
+       .dmaor_is_32bit = 1,
+       .needs_tend_set = 1,
+       .no_dmars       = 1,
+ };
+ static struct resource sh7372_usb_dmae0_resources[] = {
+       {
+               /* Channel registers and DMAOR */
+               .start  = 0xe68a0020,
+               .end    = 0xe68a0064 - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               /* VCR/SWR/DMICR */
+               .start  = 0xe68a0000,
+               .end    = 0xe68a0014 - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               /* IRQ for channels */
+               .start  = evt2irq(0x0a00),
+               .end    = evt2irq(0x0a00),
+               .flags  = IORESOURCE_IRQ,
+       },
+ };
+ static struct platform_device usb_dma0_device = {
+       .name           = "sh-dma-engine",
+       .id             = 3,
+       .resource       = sh7372_usb_dmae0_resources,
+       .num_resources  = ARRAY_SIZE(sh7372_usb_dmae0_resources),
+       .dev            = {
+               .platform_data  = &usb_dma0_platform_data,
+       },
+ };
+ /* USB DMAC1 */
+ static const struct sh_dmae_slave_config sh7372_usb_dmae1_slaves[] = {
+       {
+               .slave_id       = SHDMA_SLAVE_USB1_TX,
+               .chcr           = USBTS_INDEX2VAL(XMIT_SZ_8BYTE),
+       }, {
+               .slave_id       = SHDMA_SLAVE_USB1_RX,
+               .chcr           = USBTS_INDEX2VAL(XMIT_SZ_8BYTE),
+       },
+ };
+ static struct sh_dmae_pdata usb_dma1_platform_data = {
+       .slave          = sh7372_usb_dmae1_slaves,
+       .slave_num      = ARRAY_SIZE(sh7372_usb_dmae1_slaves),
+       .channel        = sh7372_usb_dmae_channels,
+       .channel_num    = ARRAY_SIZE(sh7372_usb_dmae_channels),
+       .ts_low_shift   = 6,
+       .ts_low_mask    = 0xc0,
+       .ts_high_shift  = 0,
+       .ts_high_mask   = 0,
+       .ts_shift       = usbts_shift,
+       .ts_shift_num   = ARRAY_SIZE(usbts_shift),
+       .dmaor_init     = DMAOR_DME,
+       .chcr_offset    = 0x14,
+       .chcr_ie_bit    = 1 << 5,
+       .dmaor_is_32bit = 1,
+       .needs_tend_set = 1,
+       .no_dmars       = 1,
+ };
+ static struct resource sh7372_usb_dmae1_resources[] = {
+       {
+               /* Channel registers and DMAOR */
+               .start  = 0xe68c0020,
+               .end    = 0xe68c0064 - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               /* VCR/SWR/DMICR */
+               .start  = 0xe68c0000,
+               .end    = 0xe68c0014 - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               /* IRQ for channels */
+               .start  = evt2irq(0x1d00),
+               .end    = evt2irq(0x1d00),
+               .flags  = IORESOURCE_IRQ,
+       },
+ };
+ static struct platform_device usb_dma1_device = {
+       .name           = "sh-dma-engine",
+       .id             = 4,
+       .resource       = sh7372_usb_dmae1_resources,
+       .num_resources  = ARRAY_SIZE(sh7372_usb_dmae1_resources),
+       .dev            = {
+               .platform_data  = &usb_dma1_platform_data,
+       },
+ };
  /* VPU */
  static struct uio_info vpu_platform_data = {
        .name = "VPU5HG",
@@@ -818,7 -962,7 +962,7 @@@ static struct platform_device *sh7372_e
        &scif4_device,
        &scif5_device,
        &scif6_device,
 -      &cmt10_device,
 +      &cmt2_device,
        &tmu00_device,
        &tmu01_device,
  };
@@@ -829,6 -973,8 +973,8 @@@ static struct platform_device *sh7372_l
        &dma0_device,
        &dma1_device,
        &dma2_device,
+       &usb_dma0_device,
+       &usb_dma1_device,
        &vpu_device,
        &veu0_device,
        &veu1_device,
  
  void __init sh7372_add_standard_devices(void)
  {
 +      sh7372_init_pm_domain(&sh7372_a4lc);
 +      sh7372_init_pm_domain(&sh7372_a4mp);
 +      sh7372_init_pm_domain(&sh7372_d4);
 +      sh7372_init_pm_domain(&sh7372_a3rv);
 +      sh7372_init_pm_domain(&sh7372_a3ri);
 +      sh7372_init_pm_domain(&sh7372_a3sg);
 +
        platform_add_devices(sh7372_early_devices,
                            ARRAY_SIZE(sh7372_early_devices));
  
        platform_add_devices(sh7372_late_devices,
                            ARRAY_SIZE(sh7372_late_devices));
 +
 +      sh7372_add_device_to_domain(&sh7372_a3rv, &vpu_device);
 +      sh7372_add_device_to_domain(&sh7372_a4mp, &spu0_device);
 +      sh7372_add_device_to_domain(&sh7372_a4mp, &spu1_device);
  }
  
  void __init sh7372_add_early_devices(void)