11 #include <linux/kernel.h>
14 #include <linux/pci.h>
20 #include <linux/i2c.h>
39 #define KUROBOX_PRO_NOR_BOOT_BASE 0xf4000000
40 #define KUROBOX_PRO_NOR_BOOT_SIZE SZ_256K
46 #define KUROBOX_PRO_NAND_BASE 0xfc000000
47 #define KUROBOX_PRO_NAND_SIZE SZ_2M
69 static struct resource kurobox_pro_nand_resource = {
76 .
parts = kurobox_pro_nand_parts,
77 .nr_parts =
ARRAY_SIZE(kurobox_pro_nand_parts),
87 .platform_data = &kurobox_pro_nand_data,
89 .resource = &kurobox_pro_nand_resource,
101 static struct resource kurobox_pro_nor_flash_resource = {
108 .
name =
"physmap-flash",
111 .platform_data = &kurobox_pro_nor_flash_data,
114 .resource = &kurobox_pro_nor_flash_resource,
139 static struct hw_pci kurobox_pro_pci __initdata = {
143 .map_irq = kurobox_pro_pci_map_irq,
146 static int __init kurobox_pro_pci_init(
void)
148 if (machine_is_kurobox_pro()) {
184 #define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2))
186 static int kurobox_pro_miconread(
unsigned char *
buf,
int count)
191 for (i = 0; i <
count; i++) {
209 static int kurobox_pro_miconwrite(
const unsigned char *
buf,
int count)
222 static int kurobox_pro_miconsend(
const unsigned char *
data,
int count)
227 unsigned char send_buf[40];
228 unsigned char correct_ack[3];
232 for (i = 0; i <
count; i++)
237 kurobox_pro_miconwrite(data, count);
240 kurobox_pro_miconwrite(&checksum, 1);
242 if (kurobox_pro_miconread(recv_buf,
sizeof(recv_buf)) <= 3) {
246 memset(&send_buf, 0xff,
sizeof(send_buf));
247 kurobox_pro_miconwrite(send_buf,
sizeof(send_buf));
251 kurobox_pro_miconread(recv_buf,
sizeof(recv_buf));
254 correct_ack[0] = 0x01;
255 correct_ack[1] = data[1];
256 correct_ack[2] = 0x00;
259 if ((recv_buf[0] + recv_buf[1] + recv_buf[2] +
260 recv_buf[3]) & 0xFF) {
262 "Received data[%02x, %02x, %02x, %02x]"
263 "\n", __func__, recv_buf[0],
264 recv_buf[1], recv_buf[2], recv_buf[3]);
267 if (correct_ack[0] == recv_buf[0] &&
268 correct_ack[1] == recv_buf[1] &&
269 correct_ack[2] == recv_buf[2]) {
279 "Received\n", __func__);
289 static void kurobox_pro_power_off(
void)
291 const unsigned char watchdogkill[] = {0x01, 0x35, 0x00};
292 const unsigned char shutdownwait[] = {0x00, 0x0c};
293 const unsigned char poweroff[] = {0x00, 0x06};
297 pr_info(
"%s: triggering power-off...\n", __func__);
309 kurobox_pro_miconsend(watchdogkill,
sizeof(watchdogkill)) ;
310 kurobox_pro_miconsend(shutdownwait,
sizeof(shutdownwait)) ;
311 kurobox_pro_miconsend(poweroff,
sizeof(poweroff));
317 static unsigned int kurobox_pro_mpp_modes[] __initdata = {
341 static void __init kurobox_pro_init(
void)
366 if (machine_is_kurobox_pro()) {
378 #ifdef CONFIG_MACH_KUROBOX_PRO
381 .atag_offset = 0x100,
382 .init_machine = kurobox_pro_init,
392 #ifdef CONFIG_MACH_LINKSTATION_PRO
393 MACHINE_START(LINKSTATION_PRO,
"Buffalo Linkstation Pro/Live")
395 .atag_offset = 0x100,
396 .init_machine = kurobox_pro_init,