Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67483
b: refs/heads/master
c: 7f21f52
h: refs/heads/master
i:
  67481: 520c9ac
  67479: f8e686f
v: v3
  • Loading branch information
Scott Wood authored and Kumar Gala committed Oct 4, 2007
1 parent 1df920c commit caf87bb
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2652d4ec4a363487d0106a8bf51f1b081dd7e397
refs/heads/master: 7f21f52940212c25b4387c2450018e161043549a
33 changes: 33 additions & 0 deletions trunk/arch/powerpc/sysdev/cpm2_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,36 @@ void *cpm_dpram_addr(unsigned long offset)
return (void *)(im_dprambase + offset);
}
EXPORT_SYMBOL(cpm_dpram_addr);

struct cpm2_ioports {
u32 dir, par, sor, odr, dat;
u32 res[3];
};

void cpm2_set_pin(int port, int pin, int flags)
{
struct cpm2_ioports __iomem *iop =
(struct cpm2_ioports __iomem *)&cpm2_immr->im_ioport;

pin = 1 << (31 - pin);

if (flags & CPM_PIN_OUTPUT)
setbits32(&iop[port].dir, pin);
else
clrbits32(&iop[port].dir, pin);

if (!(flags & CPM_PIN_GPIO))
setbits32(&iop[port].par, pin);
else
clrbits32(&iop[port].par, pin);

if (flags & CPM_PIN_SECONDARY)
setbits32(&iop[port].sor, pin);
else
clrbits32(&iop[port].sor, pin);

if (flags & CPM_PIN_OPENDRAIN)
setbits32(&iop[port].odr, pin);
else
clrbits32(&iop[port].odr, pin);
}
9 changes: 9 additions & 0 deletions trunk/include/asm-powerpc/cpm2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1247,5 +1247,14 @@ enum cpm_clk {
extern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode);
extern int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock);

#define CPM_PIN_INPUT 0
#define CPM_PIN_OUTPUT 1
#define CPM_PIN_PRIMARY 0
#define CPM_PIN_SECONDARY 2
#define CPM_PIN_GPIO 4
#define CPM_PIN_OPENDRAIN 8

void cpm2_set_pin(int port, int pin, int flags);

#endif /* __CPM2__ */
#endif /* __KERNEL__ */

0 comments on commit caf87bb

Please sign in to comment.