Buffalo NAS-Central Forums

Welcome to the Linkstation Wiki community
It is currently Sat Oct 25, 2014 2:30 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Sun Sep 14, 2008 6:28 pm 
Offline
Regular Member
User avatar

Joined: Fri Jul 25, 2008 3:23 pm
Posts: 160
Location: Kobe, Japan
Stable version is in orion.git:
http://buffalo.nas-central.org/index.ph ... ernel_Port

Development version resides here:
http://buffalo-nas-hacking.googlecode.c ... nk/kernel/

Changelog:
http://code.google.com/p/buffalo-nas-ha ... ni-setup.c

WARNING: It won't work with stock firmware. If you use stock firmware - use stock kernel.


Last edited by LaitrKeiows on Fri Sep 26, 2008 8:34 am, edited 6 times in total.

Top
 Profile  
 
PostPosted: Wed Sep 17, 2008 10:30 am 
Offline
Developer

Joined: Mon Oct 03, 2005 11:32 pm
Posts: 399
Location: France
Hello,
is this patch is enought to control power-off on the mini ?
Is the MPP configuration exactly the same as on Linkstation Pro / Kurobox Pro ?
I thought Linkstation Mini was using GPIO for buttons instead of the microcontroller that is in Linkstation Pro, but I may be wrong (At least Linkstation Duo is using GPIO instead of microcontroller).
Sylver

_________________
Kurobox Pro 500GB (for dev) / Freelink / 2.6.26-rc4 kernel, QNAP TS-409 Pro 1TB, Maxtor Shared Storage II 500GB


Top
 Profile  
 
PostPosted: Wed Sep 17, 2008 2:35 pm 
Offline
Regular Member
User avatar

Joined: Fri Jul 25, 2008 3:23 pm
Posts: 160
Location: Kobe, Japan
Sylver wrote:
is this patch is enought to control power-off on the mini ?
Is the MPP configuration exactly the same as on Linkstation Pro / Kurobox Pro ?

How do I check that?

I am able to reboot it, but a can not switch it off from linux.


Top
 Profile  
 
PostPosted: Wed Sep 17, 2008 11:15 pm 
Offline
Developer

Joined: Mon Oct 03, 2005 11:32 pm
Posts: 399
Location: France
I checked for you ;)
In the kernel from buffalo, I see that a lot of stuff is handled by using GPIO ...
I'm afraid that Linkstation Mini need a new configuration file as it's really different from a Linkstation Pro !
Code:
/*************************************************/
/****** BUFFALO Added ******************************/
/*************************************************/
#define BUFFALO_BOARD_LS_WSGL_R1_MPP0_7   0x00000003
/*                                                |||||||- gpio(0)
                                                  ||||||-- gpio(1)
                                                  |||||--- gpio(2)
                                                  ||||---- gpio(3)
                                                  |||----- gpio(4)
                                                  ||------ gpio(5)
                                                  |------- gpio(6)
                                                  -------- gpio(7)
*/
#define BUFFALO_BOARD_LS_WSGL_R1_MPP8_15   0x00000000
#define BUFFALO_BOARD_LS_WSGL_R1_MPP16_23   0x00005555

/* GPIO IRQ
   2:micon
 */

#define BUFFALO_BOARD_LS_WSGL_R1_INFO   {      \
                     \
   "BUFFALO_BOARD_LS_WSGL_R1",   /* boardName[MAX_BOARD_NAME_LEN] */   \
                           \
   {BUFFALO_BOARD_LS_WSGL_R1_MPP0_7,      /* mpp0_7 */   \
   BUFFALO_BOARD_LS_WSGL_R1_MPP8_15,      /* mpp8_15 */   \
   BUFFALO_BOARD_LS_WSGL_R1_MPP16_23,      /* mpp16_23 */   \
   BUFFALO_BOARD_LS_WSGL_R1_MPP_DEV},      /* mppDev */   \
                           \
   ((1<<2)),            /* intsGppMask */   \
                           \
   /*{params, devType, devWidth}*//* devCsInfo[MV_BOARD_MAX_DEV] */\
                           \
   {{ N_A, N_A, N_A},             /* devCs0 */   \
    { 0x8fcfffff, BOARD_DEV_NOR_FLASH, 8},      /* devCs1 */   \
    { N_A, N_A, N_A},         /* devCs2/flashCs */   \
    { 0x8fcfffff, BOARD_DEV_NOR_FLASH, 8}},   /* bootCs */   \
                              \
   /*pciBoardIf[MV_BOARD_MAX_PCI_IF];*/                \
                              \
   {{N_A,                  /* firstSlotDevNum */   \
   0,                  /* pciSlotsNum */   \
                              \
   /*pciSlot[MV_BOARD_MAX_PCI_SLOTS]*/               \
   /* {{intAGppPin, intBGppPin, intCGppPin, intDGppPin}} */      \
                              \
   {{ {N_A, N_A, N_A, N_A}},            /* pciSlot0 */      \
    { {N_A, N_A, N_A, N_A}},         /* pciSlot1 */      \
    { {N_A, N_A, N_A, N_A}}}}},         /* pciSlot2 */      \
                              \
   0x32,                  /* rtcTwsiAddr */   \
       ADDR7_BIT,               /* rtcTwsiAddrType */   \
   N_A,               /* pexPciBridgeTwsiAddr */   \
   N_A,               /* pexPciBridgeTwsiAddrType */   \
                              \
   {0x8},            /* ethPhyAddr[MV_BOARD_MAX_PORTS] */   \
                              \
   3,                  /* rtcIntPin */      \
   N_A,                  /* switchIntPin */   \
   {N_A,N_A},      /* vbusUsbGppPin[MV_BOARD_MAX_USB_IF] */   \
                              \
   0,                  /* activeLedsNumber */   \
                              \
   {N_A,                  /* led0GppPin */   \
   N_A,                    /* led1GppPin */   \
   N_A,                  /* led2GppPin */   \
   N_A,                  /* led3GppPin */   \
   N_A,                  /* led4GppPin */   \
   N_A,                  /* led5GppPin */   \
   N_A,                  /* led6GppPin */   \
   N_A},                  /* led7GppPin */   \
   0,                     /* ledsPolarity */   \
   N_A                  /* refClkGppPin */   \
}

Code:
+ #elif defined(CONFIG_BUFFALO_LINKSTATION_LSWSGL_R1)
+   #define CONFIG_BUFFALO_USE_LED_POWER_REVERSE
+   #define BIT_HDD_PWR      1
+   #define BIT_HDD_PWR1      19
+   #define BIT_USB_PWR      16
+   #define BIT_LED_INFO      3
+   #define BIT_LED_PWR      14
+   #define BIT_LED_ALARM      2
+   #define BIT_LED_FUNC      9
+   #define BIT_LED_RESERVE1   0
+   #define BIT_LED_RESERVE2   14
+   #define BIT_LED_RESERVE3   14
+   #define BIT_LED_RESERVE4   14
+   #define BIT_POWER      18
+   #define BIT_FUNC      15
+   #define BIT_AUTO_POWER      17
+   #define BIT_LED_ETH      11 //dummy
+ #endif


It also looks like the RTC chip (alarm register) is used to exchange some power status between linux and u-boot ...
Code:
+   #define MagicKeyReboot                  0x18
+   #define MagicKeyRebootUbootPassed       0x3a
+   #define MagicKeyNormalState             0x71
+   #define MagicKeyHwPoff                  0x43
+   #define MagicKeySwPoff                  0x02
+   #define MagicKeySWPoffUbootPassed       0x5c
+   #define MagicKeyFWUpdating              0x6f
+   #define MagicKeyRebootReachedHalt       0x2b
+   #define MagicKeySWPoffReachedHalt       0x7a
+   #define MagicKeyUpsShutdown      0x21
+   #define MagicKeyUpsShutdownReachedHalt   0x32

For more informations, read buffalo's drivers ;)
Sylver

_________________
Kurobox Pro 500GB (for dev) / Freelink / 2.6.26-rc4 kernel, QNAP TS-409 Pro 1TB, Maxtor Shared Storage II 500GB


Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 3:09 am 
Offline
Regular Member
User avatar

Joined: Fri Jul 25, 2008 3:23 pm
Posts: 160
Location: Kobe, Japan
Sylver wrote:
At least Linkstation Duo is using GPIO instead of microcontroller).

I compared their configs in mvBoardEnvSpec.h and found that the only difference is in one line:
Code:
#define BUFFALO_BOARD_LS_WSGL_R1_MPP16_23   0x00005555   

#define BUFFALO_BOARD_LS_WTGL_R1_MPP16_23   0x0

As for other boards:
Code:
#define BUFFALO_BOARD_HS_WDHTGL_R1_MPP8_15   0x55550000

#define BUFFALO_BOARD_LS_WTGL_R1_MPP8_15   0x00000000

With your help Sylver, now we have support for Buffalo Terastation Pro II/Live, which is TS_HTGL_R5.
Code:
#define BUFFALO_BOARD_TS_HTGL_R5_MPP0_7      0x44440000       | #define BUFFALO_BOARD_LS_WSGL_R1_MPP0_7 0x00000003
#define BUFFALO_BOARD_TS_HTGL_R5_MPP8_15     0x00000000       | #define BUFFALO_BOARD_LS_WSGL_R1_MPP8_15        0x00000000
#define BUFFALO_BOARD_TS_HTGL_R5_MPP16_23    0x0              | #define BUFFALO_BOARD_LS_WSGL_R1_MPP16_23       0x00005555
#define BUFFALO_BOARD_TS_HTGL_R5_MPP_DEV  0x0                 | #define BUFFALO_BOARD_LS_WSGL_R1_MPP_DEV        0x0

#define BUFFALO_BOARD_TS_HTGL_R5_INFO {           \           | #define BUFFALO_BOARD_LS_WSGL_R1_INFO   {               \
        ((1<<8)|(1<<9)|(1<<10)|(1<<11)),    /* intsGppMask */ |         ((1<<2)),                             

        {{ N_A, N_A, N_A},       /* devCs0 */                 |         {{ N_A, N_A, N_A},                           
         { N_A, N_A, N_A}, /* devCs1 */                    \  |          { 0x8fcfffff, BOARD_DEV_NOR_FLASH, 8},       
         { N_A, N_A, N_A},       /* devCs2/flashCs */         |          { N_A, N_A, N_A},                     
         { 0x8fcfffff, BOARD_DEV_NOR_FLASH, 8}}, /* bootCs */ |          { 0x8fcfffff, BOARD_DEV_NOR_FLASH, 8}},       

Also LS mini does not have a PCI slot.
  • Multiplexing Pins
  • Interrupts MPP

But what should I do with MPP20-MPP23?..
There is nothing said about them.


Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 9:55 am 
Offline
Regular Member
User avatar

Joined: Fri Jul 25, 2008 3:23 pm
Posts: 160
Location: Kobe, Japan
I made a simple MPP parser: http://buffalo.jpfast.net/mpp.php (source)


Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 10:22 am 
Offline
Developer

Joined: Mon Oct 03, 2005 11:32 pm
Posts: 399
Location: France
Terastation Pro is quite different anyway (different version of the SOC, no integrated SATA controller, still using the microcontroller ...)
A lot of stuff was controlled by the microcontroller, such as HDD power or board power, this have to be controlled by GPIOs on the mini ! The first step is to identify what each GPIO is used for (almost done, even if there are things to remove, like the Fan control as Mini doesn't have a fan ...).
Then we have to find what should be enabled from the kernel (USB power?). Keep in mind that u-boot is already doing some stuff about that ...)
To be able to shutdown the board, you should log a shutdown with original kernel and filesystem : is the board really shutting down, or u-boot is still running ? In this case, writing the power state in the RTC alarm register will be mandatory, but will have to be done from userland I guess ...
As you see thing are not that easy and you have to understand what is done in stock system to be able to port the board in vanilla kernel ;) i

_________________
Kurobox Pro 500GB (for dev) / Freelink / 2.6.26-rc4 kernel, QNAP TS-409 Pro 1TB, Maxtor Shared Storage II 500GB


Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 1:23 pm 
Offline
Regular Member
User avatar

Joined: Fri Jul 25, 2008 3:23 pm
Posts: 160
Location: Kobe, Japan
Sylver wrote:
To be able to shutdown the board, you should log a shutdown with original kernel and filesystem: is the board really shutting down, or u-boot is still running?

To shutdown it I need to move the switch into OFF position, and then reboot the system. After reboot or after power-on it stays partially powered:
Code:
Orion1   CPU =  Low

> Checking hardware info ...
=== Strap status : 0x00802030 ===
=== H/W boardId  :       0x33 ===
=== boardId      :       0x1a ===
=== micon_support:        off ===
> OK.
=== BUFFALO LS-WSGL/R1 U-Boot. ===
 ** LOADER **
 ** BUFFALO BOARD: BUFFALO_BOARD_LS_WSGL/R1 LE (CFG_ENV_ADDR=fffff000)


U-Boot 1.1.1 (Feb 22 2008 - 18:48:54) Marvell version: 1.12.1 - TINY
Buffalo Version: 1.13-1.00

DRAM CS[0] base 0x00000000   size 128MB
DRAM Total size 128MB
[256kB@fffc0000] Flash: 256 kB
Addresses 20M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (20M - 16M): Done

Soc: 88F5182 A2
CPU: ARM926 (Rev 0) running @ 400Mhz
Orion 1 streaming disabled
SysClock = 200Mhz , TClock = 166Mhz


USB 0: host mode
PCI 0: PCI Express Root Complex Interface
PCI 1: Conventional PCI, speed = 33000000
Net:   egiga0 [PRIME]
Using 88E1118 phy
buffalo_change_power_status > Read 0x5c
buffalo_IsStopAtUbootStatus > MagicKey=0x5c
buffalo_change_power_status > Read 0x5c
buffalo_change_power_status > Read 0x5c
buffalo_change_power_status > Writing 0x5c

Please Press HDD power button to continue ...


And when I switch it to ON:
Code:
Please Press HDD power button to continue ...
buffalo_change_power_status > Read 0x5c
buffalo_change_power_status > Writing 0x3a

Marvell Serial ATA Adapter
Integrated Sata device found
  Device 1: OK


As one can see from MPP they are mostly MPP_GPIO:
http://buffalo.jpfast.net/mpp.php?submi ... 0x00005555

Original kernel/system is able to detect when I switch it off, and reboot automatically.


Last edited by LaitrKeiows on Thu Sep 18, 2008 3:44 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 3:34 pm 
Offline
Regular Member
User avatar

Joined: Fri Jul 25, 2008 3:23 pm
Posts: 160
Location: Kobe, Japan
I made a stripped version of a patch, based on kurobox-pro config:
http://buffalo-nas-hacking.googlecode.c ... nk/kernel/

I was able to boot with it, though I unable to control leds. How do I enable them?
They were working right when I was using config from kurobox-pro:
Code:
 kurobox_pro_mpp_modes[] __init                     |  lsmini_mpp_modes[] __initdata
   {  0, MPP_UNUSED },                  |      {  0, MPP_GPIO },
   {  1, MPP_UNUSED },                  |      {  1, MPP_GPIO },
   {  2, MPP_GPIO },   /* GPIO Micon */      |      {  2, MPP_GPIO },
   {  3, MPP_GPIO },   /* GPIO Rtc */         |      {  3, MPP_GPIO },
   {  4, MPP_UNUSED },                  |      {  4, MPP_GPIO },
   {  5, MPP_UNUSED },                  |      {  5, MPP_GPIO },
   {  6, MPP_NAND }, /* NAND Flash REn */  |      {  6, MPP_GPIO },
   {  7, MPP_NAND }, /* NAND Flash WEn */  |      {  7, MPP_GPIO },
   {  8, MPP_UNUSED },                  |      {  8, MPP_GPIO },
   {  9, MPP_UNUSED },                  |      {  9, MPP_GPIO },
   { 10, MPP_UNUSED },                  |      { 10, MPP_GPIO },
   { 11, MPP_UNUSED },                  |      { 11, MPP_GPIO },
   { 12, MPP_SATA_LED }, /* SATA 0 presence */ |      { 12, MPP_GPIO },
   { 13, MPP_SATA_LED }, /* SATA 1 presence */ |      { 13, MPP_GPIO },
   { 14, MPP_SATA_LED }, /* SATA 0 active */   |      { 14, MPP_GPIO },
   { 15, MPP_SATA_LED }, /* SATA 1 active */   |      { 15, MPP_GPIO },
   { 16, MPP_UART },   /* UART1 RXD */         |      { 16, MPP_GPIO },
   { 17, MPP_UART },   /* UART1 TXD */         |      { 17, MPP_GPIO },
   { 18, MPP_UART },   /* UART1 CTSn */      |      { 18, MPP_GPIO },
   { 19, MPP_UART },   /* UART1 RTSn */      |      { 19, MPP_GPIO },
   { -1 },                        { -1 },


Thank you for you advice!


Top
 Profile  
 
PostPosted: Thu Sep 18, 2008 5:18 pm 
Offline
Developer

Joined: Mon Oct 03, 2005 11:32 pm
Posts: 399
Location: France
IMO, a more correct description would be :
Code:
static struct orion5x_mpp_mode linkstation_mini_mpp_modes[] __initdata = {
   {  0, MPP_UNUSED },
   {  1, MPP_GPIO },      /* HDD_PWR */
   {  2, MPP_GPIO },      /* LED_ALARM */
   {  3, MPP_GPIO },      /* LED_INFO */
   {  4, MPP_UNUSED },
   {  5, MPP_UNUSED },
   {  6, MPP_UNUSED },
   {  7, MPP_UNUSED },
   {  8, MPP_UNUSED },
   {  9, MPP_GPIO },      /* LED_FUNC */
   { 10, MPP_UNUSED },
   { 11, MPP_UNUSED },
   { 12, MPP_UNUSED },
   { 13, MPP_UNUSED },
   { 14, MPP_GPIO },      /* LED_PWR */
   { 15, MPP_GPIO },      /* FUNC */
   { 16, MPP_GPIO },      /* USB_PWR */
   { 17, MPP_GPIO },      /* AUTO_POWER */
   { 18, MPP_GPIO },      /* POWER */
   { 19, MPP_GPIO },      /* HDD_PWR1 */
   { -1 },
};

Anyway it will not change anything as "unused" and "gpio" are the same value in the configuration register !
Some description may not be revelant to the LS mini, you should check by yourself !

You should remove the PCI part as mini is not using PCI at all !
Also remove "orion5x_uart1_init" call as uart1 is not available on the mini ;)

To change LED status, you should write in the MPP direction register to set as output (I think it's not necessary as it's the default value), and you should write to the MPP value register to change output values to check if everything is correct. I guess that it was "working" with Linkstation config because the GPIO was configured as a SATA LED or something like that !

_________________
Kurobox Pro 500GB (for dev) / Freelink / 2.6.26-rc4 kernel, QNAP TS-409 Pro 1TB, Maxtor Shared Storage II 500GB


Top
 Profile  
 
PostPosted: Fri Sep 19, 2008 2:25 am 
Offline
Regular Member
User avatar

Joined: Fri Jul 25, 2008 3:23 pm
Posts: 160
Location: Kobe, Japan
Thanks a lot! I'll check that with GPIO.

As for the PCI part I did it the same way it is done in kurobox pro config.c:
Code:
static int __init lsmini_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) {
   int irq; // Check for devices with hard-wired IRQs:
   irq = orion5x_pci_map_irq(dev, slot, pin);
   if (irq != -1) return irq;
   return -1; // PCI isn't used on Mini
}
Should I remove this completely?


Last edited by LaitrKeiows on Fri Sep 19, 2008 3:48 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Sep 19, 2008 2:59 am 
Offline
Regular Member
User avatar

Joined: Fri Jul 25, 2008 3:23 pm
Posts: 160
Location: Kobe, Japan
Code:
        #define MagicKeyNormalState             0x71
        #define MagicKeySwPoff                  0x02

These constants, as you said, are being set and read in BufRtcDS1339AlarmB functions which are in Board/rtc/mvDS1339.c.
((1<<2)), - MPP2 is used as interrupt line
Making notes for myself :oops:

Now I am trying to get leds working.


Top
 Profile  
 
PostPosted: Fri Sep 19, 2008 7:13 am 
Offline
Developer

Joined: Mon Oct 03, 2005 11:32 pm
Posts: 399
Location: France
LaitrKeiows wrote:
Thanks a lot! I'll check that with GPIO.

As for the PCI part I did it the same way it is done in kurobox pro config.c:
Code:
static int __init lsmini_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) {
   int irq; // Check for devices with hard-wired IRQs:
   irq = orion5x_pci_map_irq(dev, slot, pin);
   if (irq != -1) return irq;
   return -1; // PCI isn't used on Mini
}
Should I remove this completely?


You should remove the whole PCI part !
But PCI-E init will work anyway, it will not be used ...

_________________
Kurobox Pro 500GB (for dev) / Freelink / 2.6.26-rc4 kernel, QNAP TS-409 Pro 1TB, Maxtor Shared Storage II 500GB


Top
 Profile  
 
PostPosted: Fri Sep 19, 2008 7:23 am 
Offline
Regular Member
User avatar

Joined: Fri Jul 25, 2008 3:23 pm
Posts: 160
Location: Kobe, Japan
Got your idea! Removed.

Also I added preliminary support for leds and a button.

Do I really need to get RTC IRQ and register the chip?


Last edited by LaitrKeiows on Fri Sep 19, 2008 7:59 am, edited 2 times in total.

Top
 Profile  
 
PostPosted: Fri Sep 19, 2008 7:32 am 
Offline
Developer

Joined: Mon Oct 03, 2005 11:32 pm
Posts: 399
Location: France
LaitrKeiows wrote:
Code:
        #define MagicKeyNormalState             0x71
        #define MagicKeySwPoff                  0x02

These constants, as you said, are being set and read in BufRtcDS1339AlarmB functions which are in Board/rtc/mvDS1339.c.
((1<<2)), - MPP2 is used as interrupt line
Making notes for myself :oops:

Now I am trying to get leds working.

You're right, it says that MPP2 is used as interrupt, but I guess it's a mistake from Buffalo... MPP2 is supposed to be for MICON (microcontroller that is not on the Mini), and RTC interrupt is supposed to be on MPP3 (3, /* rtcIntPin */) but MPP3 is not assigned to this purpose (moreover as ALARM part of the RTC chip is used for storing power state, I guess that you should better not connect the interrupt for the RTC ;))
BIT_POWER is used as an interrupt (check buffalo's GPIO driver), but I guess that it should be handled in a userland daemon (like micro_evtd for the microcontroller interrupts), but it's just my opinion !

Edit : you're right, the ETH LED seems not revelant for the Mini, it just should be removed ! I think that you'll have a better idea than me of what is dummy and what is not as I've never seens a LS Mini ;)

_________________
Kurobox Pro 500GB (for dev) / Freelink / 2.6.26-rc4 kernel, QNAP TS-409 Pro 1TB, Maxtor Shared Storage II 500GB


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Protected by Anti-Spam ACP
Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group