Re: [PATCH 3/4 v5] video, sm501: add OF binding to support SM501

2011-03-22 Thread Paul Mundt
On Thu, Mar 17, 2011 at 07:12:56AM +0100, Heiko Schocher wrote:
 Paul Mundt schrieb:
  On Tue, Mar 15, 2011 at 08:26:40AM +0100, Heiko Schocher wrote:
  0003-video-sm501-add-OF-binding-to-support-SM501.patch has no obvious 
  style problems and is ready for submission.
 
   Documentation/powerpc/dts-bindings/sm501.txt |   34 +
   drivers/mfd/sm501.c  |9 +-
   drivers/video/sm501fb.c  |   42 
  --
   3 files changed, 81 insertions(+), 4 deletions(-)
   create mode 100644 Documentation/powerpc/dts-bindings/sm501.txt
  This patchset is pending know for a while. I got Acked by from
 
  Samuel Ortiz for the mfd part, see here:
 
  http://www.spinics.net/lists/linux-fbdev/msg02550.html
  http://linux.derkeiler.com/Mailing-Lists/Kernel/2011-01/msg11798.html
 
  and for the DTS part from Benjamin Herrenschmidt:
 
  http://lists.ozlabs.org/pipermail/linuxppc-dev/2011-February/088279.html
 
  Are there some more issues?
 
  Not that I remember off the top of my head, but I think they've been lost
  in my backlog. Could you re-send the current series with the appropriate
  acked-bys? If there's nothing else obvious outstanding I'll roll them in.
 
 Ok, I resend them (I also rebase them to current tree, ok?)
 
Ok, I've dug them up on l-k in the meantime and applied 1-3. 4/4 doesn't
apply due to a missing dts file, but I assume you're aware of that and
will take care of it separately. Let me know if I've overlooked anything,
and sorry for the delay!
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 3/4 v5] video, sm501: add OF binding to support SM501

2011-03-22 Thread Heiko Schocher
Hello Paul,

Paul Mundt wrote:
 On Thu, Mar 17, 2011 at 07:12:56AM +0100, Heiko Schocher wrote:
 Paul Mundt schrieb:
 On Tue, Mar 15, 2011 at 08:26:40AM +0100, Heiko Schocher wrote:
 0003-video-sm501-add-OF-binding-to-support-SM501.patch has no obvious 
 style problems and is ready for submission.

  Documentation/powerpc/dts-bindings/sm501.txt |   34 +
  drivers/mfd/sm501.c  |9 +-
  drivers/video/sm501fb.c  |   42 
 --
  3 files changed, 81 insertions(+), 4 deletions(-)
  create mode 100644 Documentation/powerpc/dts-bindings/sm501.txt
 This patchset is pending know for a while. I got Acked by from

 Samuel Ortiz for the mfd part, see here:

 http://www.spinics.net/lists/linux-fbdev/msg02550.html
 http://linux.derkeiler.com/Mailing-Lists/Kernel/2011-01/msg11798.html

 and for the DTS part from Benjamin Herrenschmidt:

 http://lists.ozlabs.org/pipermail/linuxppc-dev/2011-February/088279.html

 Are there some more issues?

 Not that I remember off the top of my head, but I think they've been lost
 in my backlog. Could you re-send the current series with the appropriate
 acked-bys? If there's nothing else obvious outstanding I'll roll them in.
 Ok, I resend them (I also rebase them to current tree, ok?)

 Ok, I've dug them up on l-k in the meantime and applied 1-3. 4/4 doesn't
 apply due to a missing dts file, but I assume you're aware of that and
 will take care of it separately. Let me know if I've overlooked anything,
 and sorry for the delay!

No problem!

Just working on this patchset (rebase and check if it boots/works) ... will
post the update (with all patches again) in some minutes, so please wait
for it.

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v6 6/6] powerpc, tqm5200: update tqm5200_defconfig to fit for charon board.

2011-03-22 Thread Heiko Schocher
added:

CONFIG_MTD_OF_PARTS
CONFIG_MTD_PLATRAM
CONFIG_FIXED_PHY
CONFIG_SENSORS_LM80
CONFIG_MFD_SM501
CONFIG_FB
CONFIG_FB_FOREIGN_ENDIAN
CONFIG_FB_SM501
CONFIG_FRAMEBUFFER_CONSOLE
CONFIG_RTC_DRV_DS1374

Signed-off-by: Heiko Schocher h...@denx.de
cc: Wolfram Sang w.s...@pengutronix.de
cc: Grant Likely grant.lik...@secretlab.ca
cc: Benjamin Herrenschmidt b...@kernel.crashing.org
cc: linux-fb...@vger.kernel.org
cc: devicetree-disc...@ozlabs.org
cc: Ben Dooks b...@simtec.co.uk
cc: Vincent Sanders vi...@simtec.co.uk
cc: Samuel Ortiz sa...@linux.intel.com
cc: linux-ker...@vger.kernel.org
cc: Randy Dunlap rdun...@xenotime.net
cc: Wolfgang Denk w...@denx.de
cc: Paul Mundt let...@linux-sh.org
---
- changes since v1:
  added Grant Likely to cc
- changes for v6:
  - new in this version, therefore patch
powerpc, mpc5200: update mpc5200_defconfig to fit for charon board.
removed.
As this board is tqm5200 based, added necessary changes
to the tqm5200_defconfig. In previous patchserie I added
the changes to mpc5200_defconfig, as Wolfram Sang mentioned,
but as tqm5200_defconfig is in mainline, and the board is
tqm5200 based, I think, thats the appropriate place, as
new defconfigs are not accepted. Paul, before applying
this patch series, this patch should get an Acked by
from a powerpc maintainer...
  - repost the complete patchserie as Paul Mundt suggested

 arch/powerpc/configs/52xx/tqm5200_defconfig |   20 
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/configs/52xx/tqm5200_defconfig 
b/arch/powerpc/configs/52xx/tqm5200_defconfig
index 959cd2c..716a37b 100644
--- a/arch/powerpc/configs/52xx/tqm5200_defconfig
+++ b/arch/powerpc/configs/52xx/tqm5200_defconfig
@@ -1,9 +1,10 @@
 CONFIG_EXPERIMENTAL=y
 CONFIG_SYSVIPC=y
+CONFIG_SPARSE_IRQ=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_BLK_DEV_INITRD=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-CONFIG_EXPERT=y
+CONFIG_EMBEDDED=y
 # CONFIG_SYSCTL_SYSCALL is not set
 # CONFIG_KALLSYMS is not set
 # CONFIG_EPOLL is not set
@@ -17,7 +18,6 @@ CONFIG_PPC_MPC5200_SIMPLE=y
 CONFIG_PPC_MPC5200_BUGFIX=y
 # CONFIG_PPC_PMAC is not set
 CONFIG_PPC_BESTCOMM=y
-CONFIG_SPARSE_IRQ=y
 CONFIG_PM=y
 # CONFIG_PCI is not set
 CONFIG_NET=y
@@ -38,17 +38,18 @@ CONFIG_MTD=y
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_OF_PARTS=y
 CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_CFI=y
 CONFIG_MTD_CFI_AMDSTD=y
 CONFIG_MTD_ROM=y
 CONFIG_MTD_PHYSMAP_OF=y
+CONFIG_MTD_PLATRAM=y
 CONFIG_PROC_DEVICETREE=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=32768
-# CONFIG_MISC_DEVICES is not set
 CONFIG_BLK_DEV_SD=y
 CONFIG_CHR_DEV_SG=y
 CONFIG_ATA=y
@@ -56,13 +57,11 @@ CONFIG_PATA_MPC52xx=y
 CONFIG_PATA_PLATFORM=y
 CONFIG_NETDEVICES=y
 CONFIG_LXT_PHY=y
+CONFIG_FIXED_PHY=y
 CONFIG_NET_ETHERNET=y
 CONFIG_FEC_MPC52xx=y
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_1 is not set
-# CONFIG_INPUT is not set
-# CONFIG_SERIO is not set
-# CONFIG_VT is not set
 CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
@@ -70,7 +69,13 @@ CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_MPC=y
+CONFIG_SENSORS_LM80=y
 CONFIG_WATCHDOG=y
+CONFIG_MFD_SM501=y
+CONFIG_FB=y
+CONFIG_FB_FOREIGN_ENDIAN=y
+CONFIG_FB_SM501=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_USB=y
 CONFIG_USB_DEVICEFS=y
 # CONFIG_USB_DEVICE_CLASS is not set
@@ -80,10 +85,10 @@ CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
 CONFIG_USB_STORAGE=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_DS1307=y
+CONFIG_RTC_DRV_DS1374=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-CONFIG_INOTIFY=y
 CONFIG_MSDOS_FS=y
 CONFIG_VFAT_FS=y
 CONFIG_PROC_KCORE=y
@@ -102,7 +107,6 @@ CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_HUNG_TASK=y
 # CONFIG_DEBUG_BUGVERBOSE is not set
 CONFIG_DEBUG_INFO=y
-# CONFIG_RCU_CPU_STALL_DETECTOR is not set
 CONFIG_CRYPTO_ECB=y
 CONFIG_CRYPTO_PCBC=y
 # CONFIG_CRYPTO_ANSI_CPRNG is not set
-- 
1.7.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v6 0/6] powerpc, 52xx: add charon board support

2011-03-22 Thread Heiko Schocher
cc: Wolfram Sang w.s...@pengutronix.de
cc: Grant Likely grant.lik...@secretlab.ca
cc: Benjamin Herrenschmidt b...@kernel.crashing.org
cc: linux-fb...@vger.kernel.org
cc: devicetree-disc...@ozlabs.org
cc: Ben Dooks b...@simtec.co.uk
cc: Vincent Sanders vi...@simtec.co.uk
cc: Samuel Ortiz sa...@linux.intel.com
cc: linux-ker...@vger.kernel.org
cc: Randy Dunlap rdun...@xenotime.net
cc: Wolfgang Denk w...@denx.de
cc: Paul Mundt let...@linux-sh.org

changes since v5:
- repost complete patchseries, as Paul Mundt suggested
- rebased against current head
- add Acked-by from Samuel Ortiz (MFD parts)
  http://www.spinics.net/lists/linux-fbdev/msg02550.html
  http://linux.derkeiler.com/Mailing-Lists/Kernel/2011-01/msg11798.html

  and Benjamin Herrenschmidt (DTS parts)
  http://lists.ozlabs.org/pipermail/linuxppc-dev/2011-February/088279.html
- removed patch 
  powerpc, mpc5200: update mpc5200_defconfig to fit for charon board.
  therefore added
  powerpc, tqm5200: update tqm5200_defconfig to fit for charon board.

  Paul: before adding this patchseries, this patch should get
an Acked-by from a powerpc maintainer. 

checkpatch says:
total: 0 errors, 0 warnings, 233 lines checked

20110322/0001-powerpc-5200-add-support-for-charon-board.patch has no obvious 
style problems and is ready for submission.
total: 0 errors, 0 warnings, 841 lines checked

20110322/0002-video-sm501-add-I-O-functions-for-use-on-powerpc.patch has no 
obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 109 lines checked

20110322/0003-video-sm501-add-edid-and-commandline-support.patch has no obvious 
style problems and is ready for submission.
total: 0 errors, 0 warnings, 106 lines checked

20110322/0004-video-sm501-add-OF-binding-to-support-SM501.patch has no obvious 
style problems and is ready for submission.
total: 0 errors, 0 warnings, 22 lines checked

20110322/0005-powerpc-video-add-SM501-support-for-charon-board.patch has no 
obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 82 lines checked

20110322/0006-powerpc-tqm5200-update-tqm5200_defconfig-to-fit-for-.patch has no 
obvious style problems and is ready for submission.

Heiko Schocher (6):
  powerpc, 5200: add support for charon board
  video, sm501: add I/O functions for use on powerpc
  video, sm501: add edid and commandline support
  video, sm501: add OF binding to support SM501
  powerpc, video: add SM501 support for charon board.
  powerpc, tqm5200: update tqm5200_defconfig to fit for charon board.

 Documentation/fb/sm501.txt   |   10 +
 Documentation/powerpc/dts-bindings/sm501.txt |   34 
 arch/powerpc/boot/dts/charon.dts |  236 ++
 arch/powerpc/configs/52xx/tqm5200_defconfig  |   20 ++-
 arch/powerpc/platforms/52xx/mpc5200_simple.c |1 +
 drivers/mfd/sm501.c  |  133 +++--
 drivers/video/sm501fb.c  |  272 +-
 include/linux/sm501.h|8 +
 8 files changed, 555 insertions(+), 159 deletions(-)
 create mode 100644 Documentation/fb/sm501.txt
 create mode 100644 Documentation/powerpc/dts-bindings/sm501.txt
 create mode 100644 arch/powerpc/boot/dts/charon.dts

-- 
1.7.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v6 3/6] video, sm501: add edid and commandline support

2011-03-22 Thread Heiko Schocher
- add commandline options:
  sm501fb.mode:
Specify resolution as xresxyres[-bpp][@refresh]
  sm501fb.bpp:
Specify bit-per-pixel if not specified mode

- Add support for encoding display mode information
  in the device tree using verbatim EDID block.

  If the edid entry in the smi,sm501 node is present,
  the driver will build mode database using EDID data
  and allow setting the display modes from this database.

Signed-off-by: Heiko Schocher h...@denx.de
cc: Wolfram Sang w.s...@pengutronix.de
cc: Grant Likely grant.lik...@secretlab.ca
cc: Benjamin Herrenschmidt b...@kernel.crashing.org
cc: linux-fb...@vger.kernel.org
cc: devicetree-disc...@ozlabs.org
cc: Ben Dooks b...@simtec.co.uk
cc: Vincent Sanders vi...@simtec.co.uk
cc: Samuel Ortiz sa...@linux.intel.com
cc: linux-ker...@vger.kernel.org
cc: Randy Dunlap rdun...@xenotime.net
cc: Wolfgang Denk w...@denx.de
cc: Paul Mundt let...@linux-sh.org
---
- changes since v1:
  add Ben Dooks, Vincent Sanders and Samuel Ortiz to cc, as suggested from
  Paul Mundt.
- changes since v2:
  add comments from Randy Dunlap:
  - move parameter documentation to Documentation/fb/sm501.txt
- changes since v3:
  - rebased against v2.6.38-rc2
  - split in 3 patches
- of support patch
- i/o routine patch
- edid support patch
- changes since v4:
  - add info-pdata = sm501fb_def_pdata; in sm501fb_probe()
as Paul Mundt suggested (and I wrongly deleted)
  - move kfree(info-edid_data); to patch 3/4
as edid_data is only allocated in the CONFIG_OF case
- changes for v6:
  - repost complete patchserie
  - rebased against current head

 Documentation/fb/sm501.txt |   10 +++
 drivers/video/sm501fb.c|   65 ---
 2 files changed, 70 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/fb/sm501.txt

diff --git a/Documentation/fb/sm501.txt b/Documentation/fb/sm501.txt
new file mode 100644
index 000..8d17aeb
--- /dev/null
+++ b/Documentation/fb/sm501.txt
@@ -0,0 +1,10 @@
+Configuration:
+
+You can pass the following kernel command line options to sm501 
videoframebuffer:
+
+   sm501fb.bpp=SM501 Display driver:
+   Specifiy bits-per-pixel if not specified by 'mode'
+
+   sm501fb.mode=   SM501 Display driver:
+   Specify resolution as
+   xresxyres[-bpp][@refresh]
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 5df406c..f31252c 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -41,6 +41,26 @@
 #include linux/sm501.h
 #include linux/sm501-regs.h
 
+#include edid.h
+
+static char *fb_mode = 640x480-16@60;
+static unsigned long default_bpp = 16;
+
+static struct fb_videomode __devinitdata sm501_default_mode = {
+   .refresh= 60,
+   .xres   = 640,
+   .yres   = 480,
+   .pixclock   = 20833,
+   .left_margin= 142,
+   .right_margin   = 13,
+   .upper_margin   = 21,
+   .lower_margin   = 1,
+   .hsync_len  = 69,
+   .vsync_len  = 3,
+   .sync   = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+   .vmode  = FB_VMODE_NONINTERLACED
+};
+
 #define NR_PALETTE 256
 
 enum sm501_controller {
@@ -77,6 +97,7 @@ struct sm501fb_info {
void __iomem*regs2d;/* 2d remapped registers */
void __iomem*fbmem; /* remapped framebuffer */
size_t   fbmem_len; /* length of remapped region */
+   u8 *edid_data;
 };
 
 /* per-framebuffer private data */
@@ -1725,9 +1746,16 @@ static int sm501fb_init_fb(struct fb_info *fb,
fb-var.vmode   = FB_VMODE_NONINTERLACED;
fb-var.bits_per_pixel  = 16;
 
+   if (info-edid_data) {
+   /* Now build modedb from EDID */
+   fb_edid_to_monspecs(info-edid_data, fb-monspecs);
+   fb_videomode_to_modelist(fb-monspecs.modedb,
+fb-monspecs.modedb_len,
+fb-modelist);
+   }
+
if (enable  (pd-flags  SM501FB_FLAG_USE_INIT_MODE)  0) {
/* TODO read the mode from the current display */
-
} else {
if (pd-def_mode) {
dev_info(info-dev, using supplied mode\n);
@@ -1737,12 +1765,34 @@ static int sm501fb_init_fb(struct fb_info *fb,
fb-var.xres_virtual = fb-var.xres;
fb-var.yres_virtual = fb-var.yres;
} else {
-   ret = fb_find_mode(fb-var, fb,
+   if (info-edid_data)
+   ret = fb_find_mode(fb-var, fb, fb_mode,
+   fb-monspecs.modedb,
+   fb-monspecs.modedb_len,
+   sm501_default_mode, default_bpp);
+   else

[PATCH v6 2/6] video, sm501: add I/O functions for use on powerpc

2011-03-22 Thread Heiko Schocher
- add read/write functions for using this driver
  also on powerpc plattforms

Signed-off-by: Heiko Schocher h...@denx.de
Acked-by: Samuel Ortiz sa...@linux.intel.com
cc: Wolfram Sang w.s...@pengutronix.de
cc: Grant Likely grant.lik...@secretlab.ca
cc: Benjamin Herrenschmidt b...@kernel.crashing.org
cc: linux-fb...@vger.kernel.org
cc: devicetree-disc...@ozlabs.org
cc: Ben Dooks b...@simtec.co.uk
cc: Vincent Sanders vi...@simtec.co.uk
cc: Samuel Ortiz sa...@linux.intel.com
cc: linux-ker...@vger.kernel.org
cc: Randy Dunlap rdun...@xenotime.net
cc: Wolfgang Denk w...@denx.de
cc: Paul Mundt let...@linux-sh.org
---
- changes since v1:
  add Ben Dooks, Vincent Sanders and Samuel Ortiz to cc, as suggested from
  Paul Mundt.
- changes since v2:
  add comments from Randy Dunlap:
  - move parameter documentation to Documentation/fb/sm501.txt
- changes since v3:
  - rebased against v2.6.38-rc2
  - split in 3 patches
- of support patch
- i/o routine patch
  - use ioread/write32{be} accessors instead of
__do_readl/__do_writel{_be}
- edid support patch
- changes for v6:
  - repost complete patchserie
  - rebased against current head

 drivers/mfd/sm501.c |  125 +-
 drivers/video/sm501fb.c |  172 --
 include/linux/sm501.h   |8 ++
 3 files changed, 161 insertions(+), 144 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 5de3a76..558d5f3 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -133,10 +133,10 @@ static unsigned long decode_div(unsigned long pll2, 
unsigned long val,
 
 static void sm501_dump_clk(struct sm501_devdata *sm)
 {
-   unsigned long misct = readl(sm-regs + SM501_MISC_TIMING);
-   unsigned long pm0 = readl(sm-regs + SM501_POWER_MODE_0_CLOCK);
-   unsigned long pm1 = readl(sm-regs + SM501_POWER_MODE_1_CLOCK);
-   unsigned long pmc = readl(sm-regs + SM501_POWER_MODE_CONTROL);
+   unsigned long misct = smc501_readl(sm-regs + SM501_MISC_TIMING);
+   unsigned long pm0 = smc501_readl(sm-regs + SM501_POWER_MODE_0_CLOCK);
+   unsigned long pm1 = smc501_readl(sm-regs + SM501_POWER_MODE_1_CLOCK);
+   unsigned long pmc = smc501_readl(sm-regs + SM501_POWER_MODE_CONTROL);
unsigned long sdclk0, sdclk1;
unsigned long pll2 = 0;
 
@@ -193,29 +193,29 @@ static void sm501_dump_regs(struct sm501_devdata *sm)
void __iomem *regs = sm-regs;
 
dev_info(sm-dev, System Control   %08x\n,
-   readl(regs + SM501_SYSTEM_CONTROL));
+   smc501_readl(regs + SM501_SYSTEM_CONTROL));
dev_info(sm-dev, Misc Control %08x\n,
-   readl(regs + SM501_MISC_CONTROL));
+   smc501_readl(regs + SM501_MISC_CONTROL));
dev_info(sm-dev, GPIO Control Low %08x\n,
-   readl(regs + SM501_GPIO31_0_CONTROL));
+   smc501_readl(regs + SM501_GPIO31_0_CONTROL));
dev_info(sm-dev, GPIO Control Hi  %08x\n,
-   readl(regs + SM501_GPIO63_32_CONTROL));
+   smc501_readl(regs + SM501_GPIO63_32_CONTROL));
dev_info(sm-dev, DRAM Control %08x\n,
-   readl(regs + SM501_DRAM_CONTROL));
+   smc501_readl(regs + SM501_DRAM_CONTROL));
dev_info(sm-dev, Arbitration Ctrl %08x\n,
-   readl(regs + SM501_ARBTRTN_CONTROL));
+   smc501_readl(regs + SM501_ARBTRTN_CONTROL));
dev_info(sm-dev, Misc Timing  %08x\n,
-   readl(regs + SM501_MISC_TIMING));
+   smc501_readl(regs + SM501_MISC_TIMING));
 }
 
 static void sm501_dump_gate(struct sm501_devdata *sm)
 {
dev_info(sm-dev, CurrentGate  %08x\n,
-   readl(sm-regs + SM501_CURRENT_GATE));
+   smc501_readl(sm-regs + SM501_CURRENT_GATE));
dev_info(sm-dev, CurrentClock %08x\n,
-   readl(sm-regs + SM501_CURRENT_CLOCK));
+   smc501_readl(sm-regs + SM501_CURRENT_CLOCK));
dev_info(sm-dev, PowerModeControl %08x\n,
-   readl(sm-regs + SM501_POWER_MODE_CONTROL));
+   smc501_readl(sm-regs + SM501_POWER_MODE_CONTROL));
 }
 
 #else
@@ -231,7 +231,7 @@ static inline void sm501_dump_clk(struct sm501_devdata *sm) 
{ }
 
 static void sm501_sync_regs(struct sm501_devdata *sm)
 {
-   readl(sm-regs);
+   smc501_readl(sm-regs);
 }
 
 static inline void sm501_mdelay(struct sm501_devdata *sm, unsigned int delay)
@@ -261,11 +261,11 @@ int sm501_misc_control(struct device *dev,
 
spin_lock_irqsave(sm-reg_lock, save);
 
-   misc = readl(sm-regs + SM501_MISC_CONTROL);
+   misc = smc501_readl(sm-regs + SM501_MISC_CONTROL);
to = (misc  ~clear) | set;
 
if (to != misc) {
-   writel(to, sm-regs + SM501_MISC_CONTROL);
+   

[PATCH v6 5/6] powerpc, video: add SM501 support for charon board.

2011-03-22 Thread Heiko Schocher
Signed-off-by: Heiko Schocher h...@denx.de
cc: Wolfram Sang w.s...@pengutronix.de
cc: Grant Likely grant.lik...@secretlab.ca
cc: Benjamin Herrenschmidt b...@kernel.crashing.org
cc: linux-fb...@vger.kernel.org
cc: devicetree-disc...@ozlabs.org
cc: Ben Dooks b...@simtec.co.uk
cc: Vincent Sanders vi...@simtec.co.uk
cc: Samuel Ortiz sa...@linux.intel.com
cc: linux-ker...@vger.kernel.org
cc: Randy Dunlap rdun...@xenotime.net
cc: Wolfgang Denk w...@denx.de
cc: Paul Mundt let...@linux-sh.org
---
- changes since v1:
  - no board specific defconfig file for mpc52xx based boards as suggested
from Wolfram Sang

- changes since v2:
  add Ben Dooks, Vincent Sanders and Samuel Ortiz and lkml to cc, as
  suggested from Paul Mundt.

- changes since v3:
  - rebased against v2.6.38-rc2
- changes since v4:
  - added Paul Mundt to cc (Sorry forgot this in series v4)

 arch/powerpc/boot/dts/charon.dts |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/charon.dts b/arch/powerpc/boot/dts/charon.dts
index 9776889..0e00e50 100644
--- a/arch/powerpc/boot/dts/charon.dts
+++ b/arch/powerpc/boot/dts/charon.dts
@@ -186,6 +186,7 @@
#address-cells = 2;
#size-cells = 1;
ranges =   0 0 0xfc00 0x0200
+   1 0 0xe000 0x0400 // CS1 range, SM501
3 0 0xe800 0x0008;
 
flash@0,0 {
@@ -197,6 +198,15 @@
#address-cells = 1;
};
 
+   display@1,0 {
+   compatible = smi,sm501;
+   reg = 1 0x 0x0080
+  1 0x03e0 0x0020;
+   mode = 640x480-32@60;
+   interrupts = 1 1 3;
+   little-endian;
+   };
+
mram0@3,0 {
compatible = mtd-ram;
reg = 3 0x0 0x8;
-- 
1.7.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v6 4/6] video, sm501: add OF binding to support SM501

2011-03-22 Thread Heiko Schocher
- add binding to OF, compatible name smi,sm501

Signed-off-by: Heiko Schocher h...@denx.de
Acked-by: Samuel Ortiz sa...@linux.intel.com
cc: Wolfram Sang w.s...@pengutronix.de
cc: Grant Likely grant.lik...@secretlab.ca
cc: Benjamin Herrenschmidt b...@kernel.crashing.org
cc: linux-fb...@vger.kernel.org
cc: devicetree-disc...@ozlabs.org
cc: Ben Dooks b...@simtec.co.uk
cc: Vincent Sanders vi...@simtec.co.uk
cc: Samuel Ortiz sa...@linux.intel.com
cc: linux-ker...@vger.kernel.org
cc: Randy Dunlap rdun...@xenotime.net
cc: Wolfgang Denk w...@denx.de
cc: Paul Mundt let...@linux-sh.org
---
- changes since v1:
  add Ben Dooks, Vincent Sanders and Samuel Ortiz to cc, as suggested from
  Paul Mundt.
- changes since v2:
  add comments from Randy Dunlap:
  - move parameter documentation to Documentation/fb/sm501.txt
- changes since v3:
  - rebased against v2.6.38-rc2
  - split in 3 patches
- of support patch
  - get rid of #if defined(CONFIG_PPC_MPC52xx) usage
hide this in DTS, as Paul suggested.
- i/o routine patch
- edid support patch
- changes since v4
  replace remaining CONFIG_PPC_MPC52xx with CONFIG_OF, as
  it is no longer MPC52xx only.
- changes since v5
  free edid_data after its usage, as it is no longer needed,
  suggested from Paul Mundt. Also fall back to default if
  kmemdup(edid_data) fails.
- changes for v6:
  - repost complete patchserie
  - rebased against current head

 Documentation/powerpc/dts-bindings/sm501.txt |   34 +
 drivers/mfd/sm501.c  |8 +-
 drivers/video/sm501fb.c  |   35 +-
 3 files changed, 75 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/powerpc/dts-bindings/sm501.txt

diff --git a/Documentation/powerpc/dts-bindings/sm501.txt 
b/Documentation/powerpc/dts-bindings/sm501.txt
new file mode 100644
index 000..7d319fb
--- /dev/null
+++ b/Documentation/powerpc/dts-bindings/sm501.txt
@@ -0,0 +1,34 @@
+* SM SM501
+
+The SM SM501 is a LCD controller, with proper hardware, it can also
+drive DVI monitors.
+
+Required properties:
+- compatible : should be smi,sm501.
+- reg : contain two entries:
+- First entry: System Configuration register
+- Second entry: IO space (Display Controller register)
+- interrupts : SMI interrupt to the cpu should be described here.
+- interrupt-parent : the phandle for the interrupt controller that
+  services interrupts for this device.
+
+Optional properties:
+- mode : select a video mode:
+xresxyres[-bpp][@refresh]
+- edid : verbatim EDID data block describing attached display.
+  Data from the detailed timing descriptor will be used to
+  program the display controller.
+- little-endian: availiable on big endian systems, to
+  set different foreign endian.
+- big-endian: availiable on little endian systems, to
+  set different foreign endian.
+
+Example for MPC5200:
+   display@1,0 {
+   compatible = smi,sm501;
+   reg = 1 0x 0x0080
+  1 0x03e0 0x0020;
+   interrupts = 1 1 3;
+   mode = 640x480-32@60;
+   edid = [edid-data];
+   };
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 558d5f3..574f696 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1377,7 +1377,7 @@ static int __devinit sm501_init_dev(struct sm501_devdata 
*sm)
sm501_register_gpio(sm);
}
 
-   if (pdata-gpio_i2c != NULL  pdata-gpio_i2c_nr  0) {
+   if (pdata  pdata-gpio_i2c != NULL  pdata-gpio_i2c_nr  0) {
if (!sm501_gpio_isregistered(sm))
dev_err(sm-dev, no gpio available for i2c gpio.\n);
else
@@ -1735,10 +1735,16 @@ static struct pci_driver sm501_pci_driver = {
 
 MODULE_ALIAS(platform:sm501);
 
+static struct of_device_id __devinitdata of_sm501_match_tbl[] = {
+   { .compatible = smi,sm501, },
+   { /* end */ }
+};
+
 static struct platform_driver sm501_plat_driver = {
.driver = {
.name   = sm501,
.owner  = THIS_MODULE,
+   .of_match_table = of_sm501_match_tbl,
},
.probe  = sm501_plat_probe,
.remove = sm501_plat_remove,
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index f31252c..f275385 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -1729,6 +1729,15 @@ static int sm501fb_init_fb(struct fb_info *fb,
FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT |
FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
 
+#if defined(CONFIG_OF)
+#ifdef __BIG_ENDIAN
+   if (of_get_property(info-dev-parent-of_node, little-endian, NULL))
+   fb-flags |= FBINFO_FOREIGN_ENDIAN;
+#else
+   if (of_get_property(info-dev-parent-of_node, big-endian, NULL))
+   fb-flags |= FBINFO_FOREIGN_ENDIAN;
+#endif
+#endif
/* fixed data */
 

[PATCH v1 1/6] powerpc, 5200: add support for charon board

2011-03-22 Thread Heiko Schocher
Signed-off-by: Heiko Schocher h...@denx.de
Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org
cc: Wolfram Sang w.s...@pengutronix.de
cc: Grant Likely grant.lik...@secretlab.ca
cc: Benjamin Herrenschmidt b...@kernel.crashing.org
cc: linux-fb...@vger.kernel.org
cc: devicetree-disc...@ozlabs.org
cc: Ben Dooks b...@simtec.co.uk
cc: Vincent Sanders vi...@simtec.co.uk
cc: Samuel Ortiz sa...@linux.intel.com
cc: linux-ker...@vger.kernel.org
cc: Randy Dunlap rdun...@xenotime.net
cc: Wolfgang Denk w...@denx.de
cc: Paul Mundt let...@linux-sh.org
---
- changes since v1:
  add comments from Wolfram Sang
  - no defconfig file
  - comment corrected in DTS
  - boardlist sorted alphabetically
  - commit log without boardinfo
- changes for v6:
  - rebased against current head
  - repost complete patchserie
  - added Acked-by from Benjamin Herrenschmidt

 arch/powerpc/boot/dts/charon.dts |  226 ++
 arch/powerpc/platforms/52xx/mpc5200_simple.c |1 +
 2 files changed, 227 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/charon.dts

diff --git a/arch/powerpc/boot/dts/charon.dts b/arch/powerpc/boot/dts/charon.dts
new file mode 100644
index 000..9776889
--- /dev/null
+++ b/arch/powerpc/boot/dts/charon.dts
@@ -0,0 +1,226 @@
+/*
+ * charon board Device Tree Source
+ *
+ * Copyright (C) 2007 Semihalf
+ * Marian Balakowicz m...@semihalf.com
+ *
+ * Copyright (C) 2010 DENX Software Engineering GmbH
+ * Heiko Schocher h...@denx.de
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+/dts-v1/;
+
+/ {
+   model = anon,charon;
+   compatible = anon,charon;
+   #address-cells = 1;
+   #size-cells = 1;
+   interrupt-parent = mpc5200_pic;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,5200@0 {
+   device_type = cpu;
+   reg = 0;
+   d-cache-line-size = 32;
+   i-cache-line-size = 32;
+   d-cache-size = 0x4000;// L1, 16K
+   i-cache-size = 0x4000;// L1, 16K
+   timebase-frequency = 0;   // from bootloader
+   bus-frequency = 0;// from bootloader
+   clock-frequency = 0;  // from bootloader
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x 0x0800;  // 128MB
+   };
+
+   soc5200@f000 {
+   #address-cells = 1;
+   #size-cells = 1;
+   compatible = fsl,mpc5200-immr;
+   ranges = 0 0xf000 0xc000;
+   reg = 0xf000 0x0100;
+   bus-frequency = 0;// from bootloader
+   system-frequency = 0; // from bootloader
+
+   cdm@200 {
+   compatible = fsl,mpc5200-cdm;
+   reg = 0x200 0x38;
+   };
+
+   mpc5200_pic: interrupt-controller@500 {
+   // 5200 interrupts are encoded into two levels;
+   interrupt-controller;
+   #interrupt-cells = 3;
+   compatible = fsl,mpc5200-pic;
+   reg = 0x500 0x80;
+   };
+
+   timer@600 { // General Purpose Timer
+   compatible = fsl,mpc5200-gpt;
+   reg = 0x600 0x10;
+   interrupts = 1 9 0;
+   fsl,has-wdt;
+   };
+
+   can@900 {
+   compatible = fsl,mpc5200-mscan;
+   interrupts = 2 17 0;
+   reg = 0x900 0x80;
+   };
+
+   can@980 {
+   compatible = fsl,mpc5200-mscan;
+   interrupts = 2 18 0;
+   reg = 0x980 0x80;
+   };
+
+   gpio_simple: gpio@b00 {
+   compatible = fsl,mpc5200-gpio;
+   reg = 0xb00 0x40;
+   interrupts = 1 7 0;
+   gpio-controller;
+   #gpio-cells = 2;
+   };
+
+   usb@1000 {
+   compatible = fsl,mpc5200-ohci,ohci-be;
+   reg = 0x1000 0xff;
+   interrupts = 2 6 0;
+   };
+
+   dma-controller@1200 {
+   device_type = dma-controller;
+   compatible = fsl,mpc5200-bestcomm;
+   reg = 0x1200 0x80;
+   interrupts = 3 0 0  3 1 0  3 2 0  3 3 0
+   

Re: [PATCH v1 1/6] powerpc, 5200: add support for charon board

2011-03-22 Thread Wolfram Sang
On Tue, Mar 22, 2011 at 09:27:27AM +0100, Heiko Schocher wrote:
 Signed-off-by: Heiko Schocher h...@denx.de
 Acked-by: Benjamin Herrenschmidt b...@kernel.crashing.org
 cc: Wolfram Sang w.s...@pengutronix.de
 cc: Grant Likely grant.lik...@secretlab.ca
 cc: Benjamin Herrenschmidt b...@kernel.crashing.org
 cc: linux-fb...@vger.kernel.org
 cc: devicetree-disc...@ozlabs.org
 cc: Ben Dooks b...@simtec.co.uk
 cc: Vincent Sanders vi...@simtec.co.uk
 cc: Samuel Ortiz sa...@linux.intel.com
 cc: linux-ker...@vger.kernel.org
 cc: Randy Dunlap rdun...@xenotime.net
 cc: Wolfgang Denk w...@denx.de
 cc: Paul Mundt let...@linux-sh.org
 ---
 - changes since v1:
   add comments from Wolfram Sang
   - no defconfig file
   - comment corrected in DTS
   - boardlist sorted alphabetically
   - commit log without boardinfo
 - changes for v6:
   - rebased against current head
   - repost complete patchserie
   - added Acked-by from Benjamin Herrenschmidt
 
  arch/powerpc/boot/dts/charon.dts |  226 
 ++
  arch/powerpc/platforms/52xx/mpc5200_simple.c |1 +
  2 files changed, 227 insertions(+), 0 deletions(-)
  create mode 100644 arch/powerpc/boot/dts/charon.dts

AFAICR all my concerns have been addressed, so

Acked-by: Wolfram Sang w.s...@pengutronix.de

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v6 6/6] powerpc, tqm5200: update tqm5200_defconfig to fit for charon board.

2011-03-22 Thread Wolfram Sang
 As this board is tqm5200 based, added necessary changes
 to the tqm5200_defconfig. In previous patchserie I added
 the changes to mpc5200_defconfig, as Wolfram Sang mentioned,
 but as tqm5200_defconfig is in mainline, and the board is
 tqm5200 based, I think, thats the appropriate place, as

I'd think the perfect solution would have been to merge the
tqm-defconfig into the mpc5200-defconfig entirely and get rid of it.
That being said, I don't think this issue is big enough to block this
series, so fine enough with me.

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Booting with ramdisk in kernel

2011-03-22 Thread Guillaume Dargaud
Hello all,
I already posted this on the buildroot mailing list, so apologies for the dupe, 
but maybe it's more relevant here.

I'm trying to do something very classic, but it doesn't seem to work and the 
more I read about it the more I'm confused 
by the amount of antiquated info and nearly-but-not-quite-so relevant info 
(like doing a temporary ramdisk before the 
'real' OS loads).

So I have a kernel and a buildroot-generated OS, currently on an NFS server. I 
boot with the following kernel parameters 
and everything goes fine:
console=ttyUL0,115200 rw root=/dev/nfs ip=bootp

Now I want to embed that OS in the kernel (no need for a network anymore as the 
kernel is on a flash mem and I wrote my 
own bootloader). So I did the following:
- add ROOTFS CPIO to the buildroot options and make a new version
- point CONFIG_INITRAMFS_SOURCE to the resulting rootfs.cpio file
- change the kernel parameters to console=ttyUL0,115200 root=/dev/ram (that's 
in a dts file)
- some documentation talks about CONFIG_BLK_DEV_RAM but I can't find that 
option in the menuconfig, so maybe that's the 
problem.

When my bootloader jumps to 0x40, the kernel stops instantly without even a 
blip on the console. A debugger reveals 
that it stops at 0x401718... I have no idea what's going on at this stage.

What am I doing wrong ?
-- 
Guillaume Dargaud
http://www.gdargaud.net/
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/3, v4] powerpc/mpc512x: Add initial support for TWR-MPC5125

2011-03-22 Thread vooon...@gmail.com
Adds Freescale TWR-MPC5125 device tree and platform code.

Currently following is supported:
 - NAND
 - FEC1 and FEC2
 - RTC
 - PSC UART

NAND flash controller require more tests, so it will be later.

Signed-off-by: Vladimir Ermakov vooon...@gmail.com
---
v2:
 - add PSC compat string selection
 - add ioctl defines

v3:
 - less verbose interrupt-parent
 - move mpc512x_select_psc_compat() to mpc512x_shared.c
 - remove unneded mpc5125_psc_iopad_init()
 - fix board prefixes

v4:
 - remove device_type from ethernet nodes
 - add aliases for ethernet nodes
 - add phy-connection-type
 - extend size of rootfs partition
---
 arch/powerpc/boot/dts/mpc5125twr.dts |  376 ++
 arch/powerpc/platforms/512x/Kconfig  |   14 +
 arch/powerpc/platforms/512x/Makefile |1 +
 arch/powerpc/platforms/512x/clock.c  |9 +-
 arch/powerpc/platforms/512x/mpc5125_twr.c|  142 ++
 arch/powerpc/platforms/512x/mpc512x.h|5 +-
 arch/powerpc/platforms/512x/mpc512x_shared.c |   26 ++-
 7 files changed, 569 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc5125twr.dts
b/arch/powerpc/boot/dts/mpc5125twr.dts
new file mode 100644
index 000..ca3851d
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc5125twr.dts
@@ -0,0 +1,376 @@
+/*
+ * STx/Freescale ADS5125 MPC5125 silicon
+ *
+ * Copyright (C) 2009 Freescale Semiconductor Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+/dts-v1/;
+
+/ {
+   model = mpc5125twr; // In BSP mpc5125ads
+   compatible = fsl,mpc5125ads;
+   #address-cells = 1;
+   #size-cells = 1;
+   interrupt-parent = ipic;
+
+   aliases {
+   ethernet0 = eth0;
+   ethernet1 = eth1;
+   };
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   PowerPC,5125@0 {
+   device_type = cpu;
+   reg = 0;
+   d-cache-line-size = 0x20; // 32 bytes
+   i-cache-line-size = 0x20; // 32 bytes
+   d-cache-size = 0x8000;// L1, 32K
+   i-cache-size = 0x8000;// L1, 32K
+   timebase-frequency = 4950;// 49.5 MHz (csb/4)
+   bus-frequency = 19800;// 198 MHz csb bus
+   clock-frequency = 39600;  // 396 MHz ppc core
+   };
+   };
+
+   memory {
+   device_type = memory;
+   reg = 0x 0x1000;  // 256MB at 0
+   };
+
+   sram@3000 {
+   compatible = fsl,mpc5121-sram;
+   reg = 0x3000 0x08000; // 32K at 0x3000
+   };
+
+   nfc@4000 {
+   compatible = fsl,mpc5125-nfc;
+   reg = 0x4000 0x10;// 1M at 0x4000
+   interrupts = 6 0x8;
+   #address-cells = 1;
+   #size-cells = 1;
+   bank-width = 1;
+   write-size = 4096;
+   spare-size = 128;
+   chips = 1;
+   // NOTE: partition map different than in BSP
+   // First three is the same as in BSP, other differ.
+   nand-spl@0 {
+   label = loader;
+   reg = 0x 0x0010;
+   read-only;
+   };
+   uboot@10 {
+   label = uboot;
+   reg = 0x0010 0x0010;
+   read-only;
+   };
+   uboot-env@20 {
+   label = uboot-env;
+   reg = 0x0020 0x0010;
+   read-only;
+   };
+   kernel@30 {
+   label = kernel;
+   reg = 0x0030 0x0080;
+   };
+   device-tree@b0 {
+   label = device-tree;
+   reg = 0x00b0 0x0010;
+   };
+   ramboot-rootfs@c0 {
+   label = ramboot-rootfs;
+   reg = 0x00c0 0x0080;
+   };
+   rootfs@140 {
+   label = rootfs;
+   reg = 0x0140 0x0280;
+   };
+   user@280 {
+   label = user;
+   reg = 0x03C0 0x0140;
+   };
+   SRAM@420 {
+   label = SRAM; // NVRAM emul
+   reg = 0x0500 0x0140;
+   };
+   prom@560 {
+   label = prom;
+

Re: [PATCH 2/3,v2] serial: Add PSC UART support for MPC5125 SoC

2011-03-22 Thread vooon...@gmail.com
Adds PSC UART support for MPC5125 SoC.

MPC5125 has different register map than in MPC5121.

Signed-off-by: Vladimir Ermakov vooon...@gmail.com
---
v2:
 - Replace hack with replacing struct mpc52xx_psc to proper code.
---
 arch/powerpc/include/asm/mpc52xx_psc.h |   49 
 drivers/tty/serial/mpc52xx_uart.c  |  406 
 2 files changed, 414 insertions(+), 41 deletions(-)

diff --git a/arch/powerpc/include/asm/mpc52xx_psc.h
b/arch/powerpc/include/asm/mpc52xx_psc.h
index 2966df6..d0ece25 100644
--- a/arch/powerpc/include/asm/mpc52xx_psc.h
+++ b/arch/powerpc/include/asm/mpc52xx_psc.h
@@ -299,4 +299,53 @@ struct mpc512x_psc_fifo {
 #define rxdata_32 rxdata.rxdata_32
 };

+struct mpc5125_psc {
+   u8  mr1;/* PSC + 0x00 */
+   u8  reserved0[3];
+   u8  mr2;/* PSC + 0x04 */
+   u8  reserved1[3];
+   struct {
+   u16 status; /* PSC + 0x08 */
+   u8  reserved2[2];
+   u8  clock_select;   /* PSC + 0x0c */
+   u8  reserved3[3];
+   } sr_csr;
+   u8  command;/* PSC + 0x10 */
+   u8  reserved4[3];
+   union { /* PSC + 0x14 */
+   u8  buffer_8;
+   u16 buffer_16;
+   u32 buffer_32;
+   } buffer;
+   struct {
+   u8  ipcr;   /* PSC + 0x18 */
+   u8  reserved5[3];
+   u8  acr;/* PSC + 0x1c */
+   u8  reserved6[3];
+   } ipcr_acr;
+   struct {
+   u16 isr;/* PSC + 0x20 */
+   u8  reserved7[2];
+   u16 imr;/* PSC + 0x24 */
+   u8  reserved8[2];
+   } isr_imr;
+   u8  ctur;   /* PSC + 0x28 */
+   u8  reserved9[3];
+   u8  ctlr;   /* PSC + 0x2c */
+   u8  reserved10[3];
+   u32 ccr;/* PSC + 0x30 */
+   u32 ac97slots;  /* PSC + 0x34 */
+   u32 ac97cmd;/* PSC + 0x38 */
+   u32 ac97data;   /* PSC + 0x3c */
+   u8  reserved11[4];
+   u8  ip; /* PSC + 0x44 */
+   u8  reserved12[3];
+   u8  op1;/* PSC + 0x48 */
+   u8  reserved13[3];
+   u8  op0;/* PSC + 0x4c */
+   u8  reserved14[3];
+   u32 sicr;   /* PSC + 0x50 */
+   u8  reserved15[4];  /* make eq. sizeof(mpc52xx_psc) */
+};
+
 #endif  /* __ASM_MPC52xx_PSC_H__ */
diff --git a/drivers/tty/serial/mpc52xx_uart.c
b/drivers/tty/serial/mpc52xx_uart.c
index a0bcd8a..b53c03a 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -121,6 +121,15 @@ struct psc_ops {
void(*fifoc_uninit)(void);
void(*get_irq)(struct uart_port *, struct device_node *);
irqreturn_t (*handle_irq)(struct uart_port *port);
+   u16 (*get_status)(struct uart_port *port);
+   u8  (*get_ipcr)(struct uart_port *port);
+   void(*command)(struct uart_port *port, u8 cmd);
+   void(*set_mode)(struct uart_port *port, u8 mr1, u8 mr2);
+   void(*set_rts)(struct uart_port *port, int state);
+   void(*enable_ms)(struct uart_port *port);
+   void(*set_sicr)(struct uart_port *port, u32 val);
+   void(*set_imr)(struct uart_port *port, u16 val);
+   u8  (*get_mr1)(struct uart_port *port);
 };

 /* setting the prescaler and divisor reg is common for all chips */
@@ -133,6 +142,74 @@ static inline void mpc52xx_set_divisor(struct
mpc52xx_psc __iomem *psc,
out_8(psc-ctlr, divisor  0xff);
 }

+static inline void mpc5125_set_divisor(struct mpc5125_psc __iomem *psc,
+   u8 prescaler, unsigned int divisor)
+{
+   /* select prescaler */
+   out_8(psc-mpc52xx_psc_clock_select, prescaler);
+   out_8(psc-ctur, divisor  8);
+   out_8(psc-ctlr, divisor  0xff);
+}
+
+static u16 mpc52xx_psc_get_status(struct uart_port *port)
+{
+   return in_be16(PSC(port)-mpc52xx_psc_status);
+}
+
+static u8 mpc52xx_psc_get_ipcr(struct uart_port *port)
+{
+   return in_8(PSC(port)-mpc52xx_psc_ipcr);
+}
+
+static void mpc52xx_psc_command(struct uart_port *port, u8 cmd)
+{
+   out_8(PSC(port)-command, cmd);
+}
+
+static void mpc52xx_psc_set_mode(struct uart_port *port, u8 mr1, u8 mr2)
+{
+   

Re: [PATCH 3/3, v2] fs_enet: Add PHY interface selection for MPC5121 fs_enet.

2011-03-22 Thread vooon...@gmail.com
Add PHY interface selection for MPC5121 fs_enet.

Adds phy-connection-type optional property for ethernet node.
It should be rmii or mii.

Signed-off-by: Vladimir Ermakov vooon...@gmail.com
---
v2:
 - replace Kconfig to device tree
 - add phy-connection-type for mpc5121-fec nodes
---
 drivers/net/fs_enet/fec.h  |6 --
 drivers/net/fs_enet/fs_enet-main.c |   14 --
 drivers/net/fs_enet/mac-fec.c  |9 ++---
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fs_enet/fec.h b/drivers/net/fs_enet/fec.h
index e980527..9fd1ff5 100644
--- a/drivers/net/fs_enet/fec.h
+++ b/drivers/net/fs_enet/fec.h
@@ -23,6 +23,10 @@
 #define FEC_ECNTRL_ETHER_EN0x0002
 #define FEC_ECNTRL_RESET   0x0001

+/* RMII mode enabled only when MII_MODE bit is set too. */
+#define FEC_RCNTRL_RMII_MODE   (0x0100 | \
+   FEC_RCNTRL_MII_MODE | FEC_RCNTRL_FCE)
+#define FEC_RCNTRL_FCE 0x0020
 #define FEC_RCNTRL_BC_REJ  0x0010
 #define FEC_RCNTRL_PROM0x0008
 #define FEC_RCNTRL_MII_MODE0x0004
@@ -33,8 +37,6 @@
 #define FEC_TCNTRL_HBC 0x0002
 #define FEC_TCNTRL_GTS 0x0001

-
-
 /*
  * Delay to wait for FEC reset command to complete (in us)
  */
diff --git a/drivers/net/fs_enet/fs_enet-main.c
b/drivers/net/fs_enet/fs_enet-main.c
index 24cb953..c424159 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -788,16 +788,20 @@ static int fs_init_phy(struct net_device *dev)
 {
struct fs_enet_private *fep = netdev_priv(dev);
struct phy_device *phydev;
+   phy_interface_t iface;

fep-oldlink = 0;
fep-oldspeed = 0;
fep-oldduplex = -1;

+   iface = (fep-fpi-use_rmii) ?
+   PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII;
+
phydev = of_phy_connect(dev, fep-fpi-phy_node, fs_adjust_link, 0,
-   PHY_INTERFACE_MODE_MII);
+   iface);
if (!phydev) {
phydev = of_phy_connect_fixed_link(dev, fs_adjust_link,
-  PHY_INTERFACE_MODE_MII);
+  iface);
}
if (!phydev) {
dev_err(dev-dev, Could not attach to PHY\n);
@@ -1005,6 +1009,7 @@ static int __devinit fs_enet_probe(struct
platform_device *ofdev)
struct fs_platform_info *fpi;
const u32 *data;
const u8 *mac_addr;
+   char *phy_connection_type;
int privsize, len, ret = -ENODEV;

if (!ofdev-dev.of_match)
@@ -1032,6 +1037,11 @@ static int __devinit fs_enet_probe(struct
platform_device *ofdev)
  NULL)))
goto out_free_fpi;

+   phy_connection_type = of_get_property(ofdev-dev.of_node,
+   phy-connection-type, NULL);
+   if (phy_connection_type  strcmp(rmii, phy_connection_type) == 0)
+   fpi-use_rmii = 1;
+
privsize = sizeof(*fep) +
   sizeof(struct sk_buff **) *
   (fpi-rx_ring + fpi-tx_ring);
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index 61035fc..7ba36c1 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -322,10 +322,11 @@ static void restart(struct net_device *dev)
FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */
 #else
/*
-* Only set MII mode - do not touch maximum frame length
+* Only set MII/RMII mode - do not touch maximum frame length
 * configured before.
 */
-   FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE);
+   FS(fecp, r_cntrl, (fpi-use_rmii) ?
+   FEC_RCNTRL_RMII_MODE : FEC_RCNTRL_MII_MODE);
 #endif
/*
 * adjust to duplex mode
@@ -381,7 +382,9 @@ static void stop(struct net_device *dev)

/* shut down FEC1? that's where the mii bus is */
if (fpi-has_phy) {
-   FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */
+   FS(fecp, r_cntrl, (fpi-use_rmii) ?
+   FEC_RCNTRL_RMII_MODE :
+   FEC_RCNTRL_MII_MODE);   /* MII/RMII enable */
FS(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN);
FW(fecp, ievent, FEC_ENET_MII);
FW(fecp, mii_speed, feci-mii_speed);
-- 
1.7.1
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v6 0/6] powerpc, 52xx: add charon board support

2011-03-22 Thread Grant Likely
On Tue, Mar 22, 2011 at 2:27 AM, Heiko Schocher h...@denx.de wrote:
 cc: Wolfram Sang w.s...@pengutronix.de
 cc: Grant Likely grant.lik...@secretlab.ca
 cc: Benjamin Herrenschmidt b...@kernel.crashing.org
 cc: linux-fb...@vger.kernel.org
 cc: devicetree-disc...@ozlabs.org
 cc: Ben Dooks b...@simtec.co.uk
 cc: Vincent Sanders vi...@simtec.co.uk
 cc: Samuel Ortiz sa...@linux.intel.com
 cc: linux-ker...@vger.kernel.org
 cc: Randy Dunlap rdun...@xenotime.net
 cc: Wolfgang Denk w...@denx.de
 cc: Paul Mundt let...@linux-sh.org

 changes since v5:
 - repost complete patchseries, as Paul Mundt suggested
 - rebased against current head
 - add Acked-by from Samuel Ortiz (MFD parts)
  http://www.spinics.net/lists/linux-fbdev/msg02550.html
  http://linux.derkeiler.com/Mailing-Lists/Kernel/2011-01/msg11798.html

  and Benjamin Herrenschmidt (DTS parts)
  http://lists.ozlabs.org/pipermail/linuxppc-dev/2011-February/088279.html
 - removed patch
  powerpc, mpc5200: update mpc5200_defconfig to fit for charon board.
  therefore added
  powerpc, tqm5200: update tqm5200_defconfig to fit for charon board.

Why?  As Wolfram mentioned, I'd rather see mpc5200 defconfig used.
Eventually I'd like to remove tqm5200_defconfig

I'll look through the rest of the patches soon.

g.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: mmotm threatens ppc preemption again

2011-03-22 Thread Jeremy Fitzhardinge
On 03/21/2011 10:52 PM, Benjamin Herrenschmidt wrote:
 On Mon, 2011-03-21 at 11:24 +, Jeremy Fitzhardinge wrote:
 I'm very sorry about that, I didn't realize power was also using that
 interface.  Unfortunately, the no preemption definition was an error,
 and had to be changed to match the pre-existing locking rules.

 Could you implement a similar flush batched pte updates on context
 switch as x86? 
 Well, we already do that for -rt  co.

 However, we have another issue which is the reason we used those
 lazy_mmu hooks to do our flushing.

 Our PTEs eventually get faulted into a hash table which is what the real
 MMU uses. We must never (ever) allow that hash table to contain a
 duplicate entry for a given virtual address.

 When we do a batch, we remove things from the linux PTE, and keep a
 reference in our batch structure, and only update the hash table at the
 end of the batch.

Wouldn't implicitly ending a batch on context switch get the same effect?

 That means that we must not allow a hash fault to populate the hash with
 a new PTE value prior to the old one having been flushed out (which is
 possible if they different in protection attributes for example). For
 that to happen, we must basically not allow a page fault to re-populate
 a PTE invalidated by a batch before that batch has completed.

Kernel ptes are not generally populated on fault though, unless there's
something in power?  On x86 it can happen when syncing a process's
kernel pmd with the init_mm one, but that shouldn't happen in the middle
of an update since you'd deadlock anyway.  If a particular kernel
subsystem has its own locks to manage the ptes for a kernel mapping,
then that should prevent any nested updates within a batch shouldn't it?

 That translates to batches must only happen within a PTE lock section.

Well, in that case, I guess your best bet is to disable batching for
kernel pagetable updates.  These apply_to_page_range() changes are the
first time any attempt to batch kernel pagetable updates has been made
(otherwise you would have seen this problem earlier), so not batching
them will not be a regression for you.

But I'm not sure what the proper fix to get batching in your case will
be.  But the assumption that there's a pte lock for kernel ptes is not
valid.

J
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev