Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
authorPaul Mundt <lethal@linux-sh.org>
Mon, 16 Aug 2010 04:32:24 +0000 (13:32 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 16 Aug 2010 04:32:24 +0000 (13:32 +0900)
Conflicts:
arch/sh/include/asm/Kbuild
drivers/Makefile

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1  2 
arch/sh/Kconfig
arch/sh/include/asm/Kbuild
drivers/Makefile
drivers/i2c/busses/i2c-sh_mobile.c
drivers/serial/sh-sci.h

diff --combined arch/sh/Kconfig
index c91934186896d5da0ca9b2a86216aa58ada6e2f5,33990fa95af013a64e081c4bfc411f58228f64cb..b2b90ee394472f56c9386ee0b5a81271573918ec
@@@ -23,7 -23,6 +23,7 @@@ config SUPER
        select HAVE_KERNEL_LZMA
        select HAVE_KERNEL_LZO
        select HAVE_SYSCALL_TRACEPOINTS
 +      select HAVE_REGS_AND_STACK_ACCESS_API
        select RTC_LIB
        select GENERIC_ATOMIC64
        help
@@@ -99,9 -98,6 +99,6 @@@ config GENERIC_CALIBRATE_DELA
  config GENERIC_IOMAP
        bool
  
- config GENERIC_TIME
-       def_bool y
  config GENERIC_CLOCKEVENTS
        def_bool y
  
@@@ -573,7 -569,7 +570,7 @@@ config SH_CLK_CP
  config SH_CLK_CPG_LEGACY
        depends on SH_CLK_CPG
        def_bool y if !CPU_SUBTYPE_SH7785 && !ARCH_SHMOBILE && \
 -                    !CPU_SUBTYPE_SH7786
 +                    !CPU_SUBTYPE_SH7786 && !CPU_SUBTYPE_SH7757
  
  config SH_CLK_MD
        int "CPU Mode Pin Setting"
index b4d3462f1dc3667f607ff82aacb68e8a223efab1,0eed47b236abfc09c79e19254424fcaf36f26856..7beb42322f60059368590c80439617a6be614460
@@@ -3,10 -3,7 +3,9 @@@ include include/asm-generic/Kbuild.as
  header-y += cachectl.h
  header-y += cpu-features.h
  header-y += hw_breakpoint.h
- unifdef-y += unistd_32.h
- unifdef-y += unistd_64.h
- unifdef-y += posix_types_32.h
- unifdef-y += posix_types_64.h
- unifdef-y += ptrace_32.h
- unifdef-y += ptrace_64.h
+ header-y += posix_types_32.h
+ header-y += posix_types_64.h
++header-y += ptrace_32.h
++header-y += ptrace_64.h
+ header-y += unistd_32.h
+ header-y += unistd_64.h
diff --combined drivers/Makefile
index b713e75cee71add1f350df09bc592a071960c347,ae473445ad6daf11254ee269c3194c9ed03e0cb1..0861aa554dfd0b74b605eb2f27677d3e295e52ec
@@@ -92,7 -92,6 +92,7 @@@ obj-$(CONFIG_EISA)            += eisa
  obj-y                         += lguest/
  obj-$(CONFIG_CPU_FREQ)                += cpufreq/
  obj-$(CONFIG_CPU_IDLE)                += cpuidle/
 +obj-$(CONFIG_DMA_ENGINE)      += dma/
  obj-$(CONFIG_MMC)             += mmc/
  obj-$(CONFIG_MEMSTICK)                += memstick/
  obj-$(CONFIG_NEW_LEDS)                += leds/
@@@ -102,7 -101,10 +102,9 @@@ obj-y                             += firmware
  obj-$(CONFIG_CRYPTO)          += crypto/
  obj-$(CONFIG_SUPERH)          += sh/
  obj-$(CONFIG_ARCH_SHMOBILE)   += sh/
- obj-$(CONFIG_GENERIC_TIME)    += clocksource/
+ ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
+ obj-y                         += clocksource/
+ endif
 -obj-$(CONFIG_DMA_ENGINE)      += dma/
  obj-$(CONFIG_DCA)             += dca/
  obj-$(CONFIG_HID)             += hid/
  obj-$(CONFIG_PPC_PS3)         += ps3/
index 97b84b80d0ff325370a0ca3bfc9d9f569bc3d267,598c49acaeb53eb7ae3d0bc9d0b4a1873901d5b2..2707f5e17158a1dfe3b65e112f1a7a14824c253c
@@@ -119,8 -119,10 +119,10 @@@ struct sh_mobile_i2c_data 
        struct i2c_adapter adap;
  
        struct clk *clk;
+       u_int8_t icic;
        u_int8_t iccl;
        u_int8_t icch;
+       u_int8_t flags;
  
        spinlock_t lock;
        wait_queue_head_t wait;
        int sr;
  };
  
+ #define IIC_FLAG_HAS_ICIC67   (1 << 0)
  #define NORMAL_SPEED          100000 /* FAST_SPEED 400000 */
  
  /* Register offsets */
- #define ICDR(pd)              (pd->reg + 0x00)
- #define ICCR(pd)              (pd->reg + 0x04)
- #define ICSR(pd)              (pd->reg + 0x08)
- #define ICIC(pd)              (pd->reg + 0x0c)
- #define ICCL(pd)              (pd->reg + 0x10)
- #define ICCH(pd)              (pd->reg + 0x14)
+ #define ICDR                  0x00
+ #define ICCR                  0x04
+ #define ICSR                  0x08
+ #define ICIC                  0x0c
+ #define ICCL                  0x10
+ #define ICCH                  0x14
  
  /* Register bits */
  #define ICCR_ICE              0x80
  #define ICSR_WAIT             0x02
  #define ICSR_DTE              0x01
  
+ #define ICIC_ICCLB8           0x80
+ #define ICIC_ICCHB8           0x40
  #define ICIC_ALE              0x08
  #define ICIC_TACKE            0x04
  #define ICIC_WAITE            0x02
  #define ICIC_DTEE             0x01
  
+ static void iic_wr(struct sh_mobile_i2c_data *pd, int offs, unsigned char data)
+ {
+       if (offs == ICIC)
+               data |= pd->icic;
+       iowrite8(data, pd->reg + offs);
+ }
+ static unsigned char iic_rd(struct sh_mobile_i2c_data *pd, int offs)
+ {
+       return ioread8(pd->reg + offs);
+ }
+ static void iic_set_clr(struct sh_mobile_i2c_data *pd, int offs,
+                       unsigned char set, unsigned char clr)
+ {
+       iic_wr(pd, offs, (iic_rd(pd, offs) | set) & ~clr);
+ }
  static void activate_ch(struct sh_mobile_i2c_data *pd)
  {
        unsigned long i2c_clk;
        else
                pd->iccl = (u_int8_t)(num/denom);
  
+       /* one more bit of ICCL in ICIC */
+       if (pd->flags & IIC_FLAG_HAS_ICIC67) {
+               if ((num/denom) > 0xff)
+                       pd->icic |= ICIC_ICCLB8;
+               else
+                       pd->icic &= ~ICIC_ICCLB8;
+       }
        /* Calculate the value for icch. From the data sheet:
           icch = (p clock / transfer rate) * (H / (L + H)) */
        num = i2c_clk * 4;
        else
                pd->icch = (u_int8_t)(num/denom);
  
+       /* one more bit of ICCH in ICIC */
+       if (pd->flags & IIC_FLAG_HAS_ICIC67) {
+               if ((num/denom) > 0xff)
+                       pd->icic |= ICIC_ICCHB8;
+               else
+                       pd->icic &= ~ICIC_ICCHB8;
+       }
        /* Enable channel and configure rx ack */
-       iowrite8(ioread8(ICCR(pd)) | ICCR_ICE, ICCR(pd));
+       iic_set_clr(pd, ICCR, ICCR_ICE, 0);
  
        /* Mask all interrupts */
-       iowrite8(0, ICIC(pd));
+       iic_wr(pd, ICIC, 0);
  
        /* Set the clock */
-       iowrite8(pd->iccl, ICCL(pd));
-       iowrite8(pd->icch, ICCH(pd));
+       iic_wr(pd, ICCL, pd->iccl);
+       iic_wr(pd, ICCH, pd->icch);
  }
  
  static void deactivate_ch(struct sh_mobile_i2c_data *pd)
  {
        /* Clear/disable interrupts */
-       iowrite8(0, ICSR(pd));
-       iowrite8(0, ICIC(pd));
+       iic_wr(pd, ICSR, 0);
+       iic_wr(pd, ICIC, 0);
  
        /* Disable channel */
-       iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd));
+       iic_set_clr(pd, ICCR, 0, ICCR_ICE);
  
        /* Disable clock and mark device as idle */
        clk_disable(pd->clk);
@@@ -233,35 -274,35 +274,35 @@@ static unsigned char i2c_op(struct sh_m
  
        switch (op) {
        case OP_START: /* issue start and trigger DTE interrupt */
-               iowrite8(0x94, ICCR(pd));
+               iic_wr(pd, ICCR, 0x94);
                break;
        case OP_TX_FIRST: /* disable DTE interrupt and write data */
-               iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE, ICIC(pd));
-               iowrite8(data, ICDR(pd));
+               iic_wr(pd, ICIC, ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
+               iic_wr(pd, ICDR, data);
                break;
        case OP_TX: /* write data */
-               iowrite8(data, ICDR(pd));
+               iic_wr(pd, ICDR, data);
                break;
        case OP_TX_STOP: /* write data and issue a stop afterwards */
-               iowrite8(data, ICDR(pd));
-               iowrite8(0x90, ICCR(pd));
+               iic_wr(pd, ICDR, data);
+               iic_wr(pd, ICCR, 0x90);
                break;
        case OP_TX_TO_RX: /* select read mode */
-               iowrite8(0x81, ICCR(pd));
+               iic_wr(pd, ICCR, 0x81);
                break;
        case OP_RX: /* just read data */
-               ret = ioread8(ICDR(pd));
+               ret = iic_rd(pd, ICDR);
                break;
        case OP_RX_STOP: /* enable DTE interrupt, issue stop */
-               iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE,
-                        ICIC(pd));
-               iowrite8(0xc0, ICCR(pd));
+               iic_wr(pd, ICIC,
+                      ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
+               iic_wr(pd, ICCR, 0xc0);
                break;
        case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */
-               iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE,
-                        ICIC(pd));
-               ret = ioread8(ICDR(pd));
-               iowrite8(0xc0, ICCR(pd));
+               iic_wr(pd, ICIC,
+                      ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
+               ret = iic_rd(pd, ICDR);
+               iic_wr(pd, ICCR, 0xc0);
                break;
        }
  
@@@ -367,7 -408,7 +408,7 @@@ static irqreturn_t sh_mobile_i2c_isr(in
        unsigned char sr;
        int wakeup;
  
-       sr = ioread8(ICSR(pd));
+       sr = iic_rd(pd, ICSR);
        pd->sr |= sr; /* remember state */
  
        dev_dbg(pd->dev, "i2c_isr 0x%02x 0x%02x %s %d %d!\n", sr, pd->sr,
  
        if (sr & (ICSR_AL | ICSR_TACK)) {
                /* don't interrupt transaction - continue to issue stop */
-               iowrite8(sr & ~(ICSR_AL | ICSR_TACK), ICSR(pd));
+               iic_wr(pd, ICSR, sr & ~(ICSR_AL | ICSR_TACK));
                wakeup = 0;
        } else if (pd->msg->flags & I2C_M_RD)
                wakeup = sh_mobile_i2c_isr_rx(pd);
                wakeup = sh_mobile_i2c_isr_tx(pd);
  
        if (sr & ICSR_WAIT) /* TODO: add delay here to support slow acks */
-               iowrite8(sr & ~ICSR_WAIT, ICSR(pd));
+               iic_wr(pd, ICSR, sr & ~ICSR_WAIT);
  
        if (wakeup) {
                pd->sr |= SW_DONE;
@@@ -402,21 -443,21 +443,21 @@@ static int start_ch(struct sh_mobile_i2
        }
  
        /* Initialize channel registers */
-       iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd));
+       iic_set_clr(pd, ICCR, 0, ICCR_ICE);
  
        /* Enable channel and configure rx ack */
-       iowrite8(ioread8(ICCR(pd)) | ICCR_ICE, ICCR(pd));
+       iic_set_clr(pd, ICCR, ICCR_ICE, 0);
  
        /* Set the clock */
-       iowrite8(pd->iccl, ICCL(pd));
-       iowrite8(pd->icch, ICCH(pd));
+       iic_wr(pd, ICCL, pd->iccl);
+       iic_wr(pd, ICCH, pd->icch);
  
        pd->msg = usr_msg;
        pd->pos = -1;
        pd->sr = 0;
  
        /* Enable all interrupts to begin with */
-       iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE | ICIC_DTEE, ICIC(pd));
+       iic_wr(pd, ICIC, ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
        return 0;
  }
  
@@@ -451,7 -492,7 +492,7 @@@ static int sh_mobile_i2c_xfer(struct i2
  
                retry_count = 1000;
  again:
-               val = ioread8(ICSR(pd));
+               val = iic_rd(pd, ICSR);
  
                dev_dbg(pd->dev, "val 0x%02x pd->sr 0x%02x\n", val, pd->sr);
  
@@@ -497,17 -538,15 +538,17 @@@ static int sh_mobile_i2c_hook_irqs(stru
  {
        struct resource *res;
        int ret = -ENXIO;
 -      int q, m;
 -      int k = 0;
 -      int n = 0;
 +      int n, k = 0;
  
        while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
                for (n = res->start; hook && n <= res->end; n++) {
                        if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED,
 -                                      dev_name(&dev->dev), dev))
 +                                      dev_name(&dev->dev), dev)) {
 +                              for (n--; n >= res->start; n--)
 +                                      free_irq(n, dev);
 +
                                goto rollback;
 +                      }
                }
                k++;
        }
        if (hook)
                return k > 0 ? 0 : -ENOENT;
  
 -      k--;
        ret = 0;
  
   rollback:
 -      for (q = k; k >= 0; k--) {
 -              for (m = n; m >= res->start; m--)
 -                      free_irq(m, dev);
 +      k--;
 +
 +      while (k >= 0) {
 +              res = platform_get_resource(dev, IORESOURCE_IRQ, k);
 +              for (n = res->start; n <= res->end; n++)
 +                      free_irq(n, dev);
  
 -              res = platform_get_resource(dev, IORESOURCE_IRQ, k - 1);
 -              m = res->end;
 +              k--;
        }
  
        return ret;
@@@ -579,6 -617,12 +620,12 @@@ static int sh_mobile_i2c_probe(struct p
                goto err_irq;
        }
  
+       /* The IIC blocks on SH-Mobile ARM processors
+        * come with two new bits in ICIC.
+        */
+       if (size > 0x17)
+               pd->flags |= IIC_FLAG_HAS_ICIC67;
        /* Enable Runtime PM for this device.
         *
         * Also tell the Runtime PM core to ignore children
diff --combined drivers/serial/sh-sci.h
index eb7ef4951e07b8f5676887600ba2e88faaa0d2b3,9b52f77a93057af3aa7ba8e69d002190f1b4aaab..d2352ac437c58db944b0848d1fcc8dde10da0ce7
  # define SCSPTR0      0xffe00024      /* 16 bit SCIF */
  # define SCSPTR1      0xffe10024      /* 16 bit SCIF */
  # define SCIF_ORER    0x0001          /* Overrun error bit */
 -# define SCSCR_INIT(port)     0x3a    /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
 +
 +#if defined(CONFIG_SH_SH2007)
 +/* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=0 */
 +# define SCSCR_INIT(port)     0x38
 +#else
 +/* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=1 */
 +# define SCSCR_INIT(port)     0x3a
 +#endif
 +
  #elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
        defined(CONFIG_CPU_SUBTYPE_SH7786)
  # define SCSPTR0      0xffea0024      /* 16 bit SCIF */
  #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
    static inline unsigned int sci_##name##_in(struct uart_port *port)  \
    {                                                                   \
-     if (port->type == PORT_SCIF) {                                    \
+     if (port->type == PORT_SCIF || port->type == PORT_SCIFB) {                \
        SCI_IN(scif_size, scif_offset)                                  \
      } else {  /* PORT_SCI or PORT_SCIFA */                            \
        SCI_IN(sci_size, sci_offset);                                   \
    }                                                                   \
    static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
    {                                                                   \
-     if (port->type == PORT_SCIF) {                                    \
+     if (port->type == PORT_SCIF || port->type == PORT_SCIFB) {                \
        SCI_OUT(scif_size, scif_offset, value)                          \
      } else {  /* PORT_SCI or PORT_SCIFA */                            \
        SCI_OUT(sci_size, sci_offset, value);                           \
        defined(CONFIG_CPU_SUBTYPE_SH7720) || \
        defined(CONFIG_CPU_SUBTYPE_SH7721) || \
        defined(CONFIG_ARCH_SH7367) || \
-       defined(CONFIG_ARCH_SH7377) || \
-       defined(CONFIG_ARCH_SH7372)
+       defined(CONFIG_ARCH_SH7377)
+ #define SCIF_FNS(name, scif_offset, scif_size) \
+   CPU_SCIF_FNS(name, scif_offset, scif_size)
+ #elif defined(CONFIG_ARCH_SH7372)
+ #define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scifb_offset, sh4_scifb_size) \
+   CPU_SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scifb_offset, sh4_scifb_size)
  #define SCIF_FNS(name, scif_offset, scif_size) \
    CPU_SCIF_FNS(name, scif_offset, scif_size)
  #else
      defined(CONFIG_CPU_SUBTYPE_SH7720) || \
      defined(CONFIG_CPU_SUBTYPE_SH7721) || \
      defined(CONFIG_ARCH_SH7367) || \
-     defined(CONFIG_ARCH_SH7377) || \
-     defined(CONFIG_ARCH_SH7372)
+     defined(CONFIG_ARCH_SH7377)
  
  SCIF_FNS(SCSMR,  0x00, 16)
  SCIF_FNS(SCBRR,  0x04,  8)
@@@ -444,6 -439,20 +447,20 @@@ SCIF_FNS(SCFDR,  0x1c, 16
  SCIF_FNS(SCxTDR, 0x20,  8)
  SCIF_FNS(SCxRDR, 0x24,  8)
  SCIF_FNS(SCLSR,  0x00,  0)
+ #elif defined(CONFIG_ARCH_SH7372)
+ SCIF_FNS(SCSMR,  0x00, 16)
+ SCIF_FNS(SCBRR,  0x04,  8)
+ SCIF_FNS(SCSCR,  0x08, 16)
+ SCIF_FNS(SCTDSR, 0x0c, 16)
+ SCIF_FNS(SCFER,  0x10, 16)
+ SCIF_FNS(SCxSR,  0x14, 16)
+ SCIF_FNS(SCFCR,  0x18, 16)
+ SCIF_FNS(SCFDR,  0x1c, 16)
+ SCIF_FNS(SCTFDR, 0x38, 16)
+ SCIF_FNS(SCRFDR, 0x3c, 16)
+ SCIx_FNS(SCxTDR, 0x20,  8, 0x40,  8)
+ SCIx_FNS(SCxRDR, 0x24,  8, 0x60,  8)
+ SCIF_FNS(SCLSR,  0x00,  0)
  #elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
        defined(CONFIG_CPU_SUBTYPE_SH7724)
  SCIx_FNS(SCSMR,  0x00, 16, 0x00, 16)
@@@ -607,10 -616,9 +624,10 @@@ static inline int sci_rxd_in(struct uar
   * -- Mitch Davis - 15 Jul 2000
   */
  
 -#if defined(CONFIG_CPU_SUBTYPE_SH7780) || \
 -    defined(CONFIG_CPU_SUBTYPE_SH7785) || \
 -    defined(CONFIG_CPU_SUBTYPE_SH7786)
 +#if (defined(CONFIG_CPU_SUBTYPE_SH7780)  || \
 +     defined(CONFIG_CPU_SUBTYPE_SH7785)  || \
 +     defined(CONFIG_CPU_SUBTYPE_SH7786)) && \
 +    !defined(CONFIG_SH_SH2007)
  #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
  #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
        defined(CONFIG_CPU_SUBTYPE_SH7720) || \