Guest User

Nemo patch 4.9-2 (A-EON AmigaONE X1000)

a guest
Oct 15th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 15.27 KB | None | 0 0
  1. diff -rupN a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
  2. --- a/arch/powerpc/kernel/head_64.S 2016-10-15 05:42:34.463066803 +0200
  3. +++ b/arch/powerpc/kernel/head_64.S 2016-10-15 05:30:00.808345852 +0200
  4. @@ -79,6 +79,13 @@ _GLOBAL(__start)
  5.     /* NOP this out unconditionally */
  6.  BEGIN_FTR_SECTION
  7.     FIXUP_ENDIAN
  8. +/* Hack for PWRficient platforms: Due to CFE(?) bug, the 64-bit
  9. + * word at 0x8 needs to be set to 0. Patch it up here once we're
  10. + * done executing it (we can be lazy and avoid invalidating
  11. + * icache)
  12. + */
  13. +li     r0,0
  14. +std    0,8(0)
  15.     b   __start_initialization_multiplatform
  16.  END_FTR_SECTION(0, 1)
  17.  
  18. diff -rupN a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
  19. --- a/arch/powerpc/kernel/setup-common.c    2016-10-15 05:42:34.499066801 +0200
  20. +++ b/arch/powerpc/kernel/setup-common.c    2016-10-15 05:30:00.816341837 +0200
  21. @@ -84,7 +84,15 @@ EXPORT_SYMBOL(ppc_md);
  22.  struct machdep_calls *machine_id;
  23.  EXPORT_SYMBOL(machine_id);
  24.  
  25. +#ifdef CONFIG_PPC_PASEMI_NEMO
  26. +/* FIXME!!
  27. + * Current PASemi code does not correctly update the value of boot_cpuid
  28. + * As a temporary fix we use the default 0, which is known to work.
  29. + */
  30. +int boot_cpuid = 0;
  31. +#else
  32.  int boot_cpuid = -1;
  33. +#endif
  34.  EXPORT_SYMBOL_GPL(boot_cpuid);
  35.  
  36.  unsigned long klimit = (unsigned long) _end;
  37. diff -rupN a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
  38. --- a/arch/powerpc/platforms/pasemi/pci.c   2016-10-15 05:42:34.859066783 +0200
  39. +++ b/arch/powerpc/platforms/pasemi/pci.c   2016-10-15 05:30:00.824337864 +0200
  40. @@ -108,6 +108,69 @@ static int workaround_5945(struct pci_bu
  41.     return 1;
  42.  }
  43.  
  44. +#ifdef CONFIG_PPC_PASEMI_NEMO
  45. +static int sb600_bus = 5;
  46. +static void __iomem *iob_mapbase = NULL;
  47. +
  48. +static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
  49. +                             int offset, int len, u32 *val);
  50. +
  51. +static void sb600_set_flag(int bus)
  52. +{
  53. +    struct resource res;
  54. +    struct device_node *dn;
  55. +       struct pci_bus *busp;
  56. +       u32 val;
  57. +       int err;
  58. +
  59. +       if (sb600_bus == -1)
  60. +       {
  61. +               busp = pci_find_bus(0, 0);
  62. +               pa_pxp_read_config(busp, PCI_DEVFN(17,0), PCI_SECONDARY_BUS, 1, &val);
  63. +
  64. +               sb600_bus = val;
  65. +
  66. +               printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus);
  67. +       }
  68. +
  69. +       if (iob_mapbase == NULL)
  70. +       {
  71. +        dn = of_find_compatible_node(NULL, "isa", "pasemi,1682m-iob");
  72. +        if (!dn)
  73. +        {
  74. +               printk(KERN_CRIT "NEMO SB600 missing iob node\n");
  75. +                       return;
  76. +               }
  77. +
  78. +               err = of_address_to_resource(dn, 0, &res);
  79. +        of_node_put(dn);
  80. +
  81. +               if (err)
  82. +               {
  83. +               printk(KERN_CRIT "NEMO SB600 missing resource\n");
  84. +                       return;
  85. +               }
  86. +
  87. +               printk(KERN_CRIT "NEMO SB600 IOB base %08lx\n",res.start);
  88. +
  89. +               iob_mapbase = ioremap(res.start + 0x100, 0x94);
  90. +       }
  91. +
  92. +       if (iob_mapbase != NULL)
  93. +       {
  94. +               if (bus == sb600_bus)
  95. +               {
  96. +                       out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) | 0x800);
  97. +               }
  98. +               else
  99. +               {
  100. +                       out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) & ~0x800);
  101. +               }
  102. +       }
  103. +}
  104. +#endif
  105. +
  106. +
  107.  static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
  108.                   int offset, int len, u32 *val)
  109.  {
  110. @@ -126,6 +189,10 @@ static int pa_pxp_read_config(struct pci
  111.  
  112.     addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
  113.  
  114. +#ifdef CONFIG_PPC_PASEMI_NEMO
  115. +       sb600_set_flag(bus->number);
  116. +#endif
  117. +
  118.     /*
  119.      * Note: the caller has already checked that offset is
  120.      * suitably aligned and that len is 1, 2 or 4.
  121. @@ -210,6 +277,9 @@ static int __init pas_add_bridge(struct
  122.     /* Interpret the "ranges" property */
  123.     pci_process_bridge_OF_ranges(hose, dev, 1);
  124.  
  125. +   /* Scan for an isa bridge. */
  126. +   isa_bridge_find_early(hose);
  127. +
  128.     return 0;
  129.  }
  130.  
  131. diff -rupN a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
  132. --- a/arch/powerpc/platforms/pasemi/setup.c 2016-10-15 05:42:34.859066783 +0200
  133. +++ b/arch/powerpc/platforms/pasemi/setup.c 2016-10-15 05:30:00.880309854 +0200
  134. @@ -34,6 +34,7 @@
  135.  #include <asm/prom.h>
  136.  #include <asm/iommu.h>
  137.  #include <asm/machdep.h>
  138. +#include <asm/i8259.h>
  139.  #include <asm/mpic.h>
  140.  #include <asm/smp.h>
  141.  #include <asm/time.h>
  142. @@ -72,6 +73,17 @@ static void __noreturn pas_restart(char
  143.         out_le32(reset_reg, 0x6000000);
  144.  }
  145.  
  146. +#ifdef CONFIG_PPC_PASEMI_NEMO
  147. +void pas_shutdown(void)
  148. +{
  149. +       /* (added by DStevens 19/06/13)
  150. +          Set the PLD bit that makes the SB600 think the power button is being pressed */
  151. +       void __iomem *pld_map = ioremap(0xf5000000,4096);
  152. +       while (1)
  153. +               out_8(pld_map+7,0x01);
  154. +}
  155. +#endif
  156. +
  157.  #ifdef CONFIG_SMP
  158.  static arch_spinlock_t timebase_lock;
  159.  static unsigned long timebase;
  160. @@ -183,16 +195,30 @@ static int __init pas_setup_mce_regs(voi
  161.  }
  162.  machine_device_initcall(pasemi, pas_setup_mce_regs);
  163.  
  164. +#ifdef CONFIG_PPC_PASEMI_NEMO
  165. +static void sb600_8259_cascade(struct irq_desc *desc)
  166. +{
  167. +   struct irq_chip *chip = irq_desc_get_chip(desc);
  168. +   unsigned int cascade_irq = i8259_irq();
  169. +
  170. +   if (cascade_irq !=NO_IRQ)
  171. +               generic_handle_irq(cascade_irq);
  172. +
  173. +   chip->irq_eoi(&desc->irq_data);
  174. +}
  175. +#endif
  176. +
  177.  static __init void pas_init_IRQ(void)
  178.  {
  179.     struct device_node *np;
  180. -   struct device_node *root, *mpic_node;
  181. +   struct device_node *root, *mpic_node, *i8259_node;
  182.     unsigned long openpic_addr;
  183.     const unsigned int *opprop;
  184.     int naddr, opplen;
  185.     int mpic_flags;
  186.     const unsigned int *nmiprop;
  187.     struct mpic *mpic;
  188. +   int gpio_virq;
  189.  
  190.     mpic_node = NULL;
  191.  
  192. @@ -244,6 +270,22 @@ static __init void pas_init_IRQ(void)
  193.         mpic_unmask_irq(irq_get_irq_data(nmi_virq));
  194.     }
  195.  
  196. +
  197. +#ifdef CONFIG_PPC_PASEMI_NEMO
  198. +       // Connect legacy i8259 controller in SB600
  199. +   i8259_node = of_find_node_by_path("/pxp@0,e0000000");
  200. +   printk("Init i8259\n");
  201. +   i8259_init(i8259_node, 0);
  202. +   of_node_put(i8259_node);
  203. +
  204. +   gpio_virq = irq_create_mapping(NULL, 3);
  205. +   irq_set_irq_type(gpio_virq, IRQ_TYPE_LEVEL_HIGH);
  206. +   irq_set_chained_handler(gpio_virq, sb600_8259_cascade);
  207. +   mpic_unmask_irq(irq_get_irq_data(gpio_virq));
  208. +
  209. +   irq_set_default_host(mpic->irqhost);
  210. +
  211. +#endif
  212.     of_node_put(mpic_node);
  213.     of_node_put(root);
  214.  }
  215. @@ -398,6 +440,18 @@ static const struct of_device_id pasemi_
  216.     {},
  217.  };
  218.  
  219. +static struct resource rtc_resource[] = {{
  220. +   .name = "rtc",
  221. +   .start = 0x70,
  222. +   .end = 0x71,
  223. +   .flags = IORESOURCE_IO,
  224. +}, {
  225. +   .name = "rtc",
  226. +   .start = 8,
  227. +   .end = 8,
  228. +   .flags = IORESOURCE_IRQ,
  229. +}};
  230. +
  231.  static int __init pasemi_publish_devices(void)
  232.  {
  233.     pasemi_pcmcia_init();
  234. @@ -405,6 +459,10 @@ static int __init pasemi_publish_devices
  235.     /* Publish OF platform devices for SDC and other non-PCI devices */
  236.     of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
  237.  
  238. +#ifdef CONFIG_PPC_PASEMI_NEMO
  239. +   platform_device_register_simple("rtc_cmos", -1, rtc_resource, 2);
  240. +#endif
  241. +
  242.     return 0;
  243.  }
  244.  machine_device_initcall(pasemi, pasemi_publish_devices);
  245. @@ -421,9 +479,13 @@ static int __init pas_probe(void)
  246.  
  247.     iommu_init_early_pasemi();
  248.  
  249. +#ifdef CONFIG_PPC_PASEMI_NEMO
  250. +       pm_power_off              = pas_shutdown;         // Varisys provided a way to turn us off
  251. +#endif
  252.     return 1;
  253.  }
  254.  
  255. +
  256.  define_machine(pasemi) {
  257.     .name           = "PA Semi PWRficient",
  258.     .probe          = pas_probe,
  259. @@ -435,4 +497,7 @@ define_machine(pasemi) {
  260.     .calibrate_decr     = generic_calibrate_decr,
  261.     .progress       = pas_progress,
  262.     .machine_check_exception = pas_machine_check_handler,
  263. +#if 0 // def CONFIG_PPC_PASEMI_NEMO
  264. +       .pci_probe_mode = sb600_pci_probe_mode,
  265. +#endif
  266.  };
  267. diff -rupN a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
  268. --- a/drivers/ata/libata-sff.c  2016-10-15 05:42:39.063066573 +0200
  269. +++ b/drivers/ata/libata-sff.c  2016-10-15 05:30:00.956271851 +0200
  270. @@ -2429,9 +2429,9 @@ int ata_pci_sff_activate_host(struct ata
  271.     if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
  272.         u8 tmp8, mask;
  273.  
  274. -       /* TODO: What if one channel is in native mode ... */
  275. +       /* Don't look at dummy ports in the mask */
  276.         pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
  277. -       mask = (1 << 2) | (1 << 0);
  278. +       mask = (! ata_port_is_dummy(host->ports[1]) << 2) | (! ata_port_is_dummy(host->ports[0]) << 0);
  279.         if ((tmp8 & mask) != mask)
  280.             legacy_mode = 1;
  281.     }
  282. diff -rupN a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
  283. --- a/drivers/ata/pata_atiixp.c 2016-10-15 05:42:39.067066572 +0200
  284. +++ b/drivers/ata/pata_atiixp.c 2016-10-15 05:30:00.968265850 +0200
  285. @@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_de
  286.     };
  287.     const struct ata_port_info *ppi[] = { &info, &info };
  288.  
  289. +#ifdef CONFIG_PPC_PASEMI_NEMO
  290. +       // Second port not wired on SB600, and config bit cannot be set by BIOS
  291. +       ppi[1] = &ata_dummy_port_info;
  292. +#endif
  293. +
  294.     return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
  295.                       ATA_HOST_PARALLEL_SCAN);
  296.  }
  297. diff -rupN a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
  298. --- a/drivers/ata/pata_of_platform.c    2016-10-15 05:42:39.107066570 +0200
  299. +++ b/drivers/ata/pata_of_platform.c    2016-10-15 05:30:00.976261850 +0200
  300. @@ -41,14 +41,36 @@ static int pata_of_platform_probe(struct
  301.         return -EINVAL;
  302.     }
  303.  
  304. -   ret = of_address_to_resource(dn, 1, &ctl_res);
  305. -   if (ret) {
  306. -       dev_err(&ofdev->dev, "can't get CTL address from "
  307. -           "device tree\n");
  308. -       return -EINVAL;
  309. +   if (of_device_is_compatible(dn, "electra-ide")) {
  310. +       /* Altstatus is really at offset 0x3f6 from the primary window
  311. +        * on electra-ide. Adjust ctl_res and io_res accordingly.
  312. +        */
  313. +       ctl_res = io_res;
  314. +       ctl_res.start = ctl_res.start+0x3f6;
  315. +       io_res.end = ctl_res.start-1;
  316. +
  317. +#ifdef CONFIG_PPC_PASEMI_NEMO
  318. +   } else if (of_device_is_compatible(dn, "electra-cf")) {
  319. +       /* Task regs are at 0x800, with alt status @ 0x80e in the primary window
  320. +       * on electra-cf. Adjust ctl_res and io_res accordingly.
  321. +       */
  322. +       ctl_res = io_res;
  323. +       io_res.start += 0x800;
  324. +       ctl_res.start = ctl_res.start + 0x80e;
  325. +       io_res.end = ctl_res.start-1;
  326. +#endif
  327. +   } else {
  328. +       ret = of_address_to_resource(dn, 1, &ctl_res);
  329. +       if (ret) {
  330. +           dev_err(&ofdev->dev, "can't get CTL address from "
  331. +               "device tree\n");
  332. +           return -EINVAL;
  333. +       }
  334.     }
  335.  
  336.     irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
  337. +   if (irq_res)
  338. +       irq_res->flags = 0;
  339.  
  340.     prop = of_get_property(dn, "reg-shift", NULL);
  341.     if (prop)
  342. @@ -65,6 +87,11 @@ static int pata_of_platform_probe(struct
  343.         dev_info(&ofdev->dev, "pio-mode unspecified, assuming PIO0\n");
  344.     }
  345.  
  346. +#ifdef CONFIG_PPC_PASEMI_NEMO
  347. +       irq_res = 0;                    // force irq off (doesn't seem to work)
  348. +#endif
  349. +
  350. +
  351.     pio_mask = 1 << pio_mode;
  352.     pio_mask |= (1 << pio_mode) - 1;
  353.  
  354. @@ -74,6 +101,10 @@ static int pata_of_platform_probe(struct
  355.  
  356.  static struct of_device_id pata_of_platform_match[] = {
  357.     { .compatible = "ata-generic", },
  358. +   { .compatible = "electra-ide", },
  359. +#ifdef CONFIG_PPC_PASEMI_NEMO
  360. +   { .compatible = "electra-cf",},
  361. +#endif
  362.     { },
  363.  };
  364.  MODULE_DEVICE_TABLE(of, pata_of_platform_match);
  365. diff -rupN a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
  366. --- a/drivers/i2c/busses/i2c-pasemi.c   2016-10-15 05:42:46.847066183 +0200
  367. +++ b/drivers/i2c/busses/i2c-pasemi.c   2016-10-15 05:30:01.036231848 +0200
  368. @@ -365,7 +365,7 @@ static int pasemi_smb_probe(struct pci_d
  369.     smbus->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
  370.     smbus->adapter.algo = &smbus_algorithm;
  371.     smbus->adapter.algo_data = smbus;
  372. -   smbus->adapter.nr = PCI_FUNC(dev->devfn);
  373. +   smbus->adapter.nr = -1;
  374.  
  375.     /* set up the sysfs linkage to our parent device */
  376.     smbus->adapter.dev.parent = &dev->dev;
  377. @@ -373,7 +373,7 @@ static int pasemi_smb_probe(struct pci_d
  378.     reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
  379.           (CLK_100K_DIV & CTL_CLK_M)));
  380.  
  381. -   error = i2c_add_numbered_adapter(&smbus->adapter);
  382. +   error = i2c_add_adapter(&smbus->adapter);
  383.     if (error)
  384.         goto out_release_region;
  385.  
  386. diff -rupN a/drivers/pci/probe.c b/drivers/pci/probe.c
  387. --- a/drivers/pci/probe.c   2016-10-15 05:42:59.123065569 +0200
  388. +++ b/drivers/pci/probe.c   2016-10-15 05:30:01.052223845 +0200
  389. @@ -1849,6 +1849,8 @@ static int only_one_child(struct pci_bus
  390.  
  391.     if (!parent || !pci_is_pcie(parent))
  392.         return 0;
  393. +   #ifndef CONFIG_PPC_PASEMI_NEMO
  394. +   // SB600 has non-zero devices on non-root bus.
  395.     if (pci_pcie_type(parent) == PCI_EXP_TYPE_ROOT_PORT)
  396.         return 1;
  397.  
  398. @@ -1861,6 +1863,7 @@ static int only_one_child(struct pci_bus
  399.     if (parent->has_secondary_link &&
  400.         !pci_has_flag(PCI_SCAN_ALL_PCIE_DEVS))
  401.         return 1;
  402. +   #endif
  403.     return 0;
  404.  }
  405.  
  406. diff -rupN a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
  407. --- a/sound/pci/hda/patch_sigmatel.c    2016-10-15 05:43:20.267064512 +0200
  408. +++ b/sound/pci/hda/patch_sigmatel.c    2016-10-15 05:30:01.060219846 +0200
  409. @@ -166,6 +166,7 @@ enum {
  410.     STAC_D965_VERBS,
  411.     STAC_DELL_3ST,
  412.     STAC_DELL_BIOS,
  413. +   STAC_NEMO_DEFAULT,
  414.     STAC_DELL_BIOS_AMIC,
  415.     STAC_DELL_BIOS_SPDIF,
  416.     STAC_927X_DELL_DMIC,
  417. @@ -1360,6 +1361,23 @@ static const struct hda_pintbl oqo9200_p
  418.     {}
  419.  };
  420.  
  421. +static const struct hda_pintbl nemo_pin_configs[] = {
  422. +   { 0x0a, 0x02214020 },
  423. +   { 0x0b, 0x02A19080 },
  424. +   { 0x0c, 0x0181304E },
  425. +   { 0x0d, 0x01014010 },
  426. +   { 0x0e, 0x01A19040 },
  427. +   { 0x0f, 0x01011012 },
  428. +   { 0x10, 0x01016011 },
  429. +   { 0x11, 0x01012014 },
  430. +   { 0x12, 0x103301F0 },
  431. +   { 0x13, 0x00000000 },
  432. +   { 0x14, 0x00000000 },
  433. +   { 0x21, 0x01442170 },
  434. +   { 0x22, 0x00000000 },
  435. +   { 0x23, 0x00000000 },
  436. +   {}
  437. +};
  438.  
  439.  static void stac9200_fixup_panasonic(struct hda_codec *codec,
  440.                      const struct hda_fixup *fix, int action)
  441. @@ -3883,6 +3901,10 @@ static const struct hda_fixup stac927x_f
  442.         .type = HDA_FIXUP_PINS,
  443.         .v.pins = d965_5st_no_fp_pin_configs,
  444.     },
  445. +   [STAC_NEMO_DEFAULT] = {
  446. +               .type = HDA_FIXUP_PINS,
  447. +       .v.pins = nemo_pin_configs,
  448. +   },
  449.     [STAC_DELL_3ST] = {
  450.         .type = HDA_FIXUP_PINS,
  451.         .v.pins = dell_3st_pin_configs,
  452. @@ -3939,6 +3961,7 @@ static const struct hda_model_fixup stac
  453.     { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
  454.     { .id = STAC_DELL_3ST, .name = "dell-3stack" },
  455.     { .id = STAC_DELL_BIOS, .name = "dell-bios" },
  456. +   { .id = STAC_NEMO_DEFAULT, .name = "nemo-default" },   
  457.     { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
  458.     { .id = STAC_927X_VOLKNOB, .name = "volknob" },
  459.     {}
  460. @@ -3977,6 +4000,8 @@ static const struct snd_pci_quirk stac92
  461.                "Intel D965", STAC_D965_5ST),
  462.     SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
  463.                "Intel D965", STAC_D965_5ST),
  464. +   /* Nemo */
  465. +   SND_PCI_QUIRK(0x1888, 0x1000, "AmigaOne X1000", STAC_NEMO_DEFAULT),
  466.     /* volume-knob fixes */
  467.     SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
  468.     {} /* terminator */
  469. @@ -5036,6 +5061,7 @@ static const struct hda_device_id snd_hd
  470.     HDA_CODEC_ENTRY(0x83847683, "STAC9221D A2", patch_stac922x),
  471.     HDA_CODEC_ENTRY(0x83847618, "STAC9227", patch_stac927x),
  472.     HDA_CODEC_ENTRY(0x83847619, "STAC9227", patch_stac927x),
  473. +   HDA_CODEC_ENTRY(0x83847638, "STAC92HD700", patch_stac927x),
  474.     HDA_CODEC_ENTRY(0x83847616, "STAC9228", patch_stac927x),
  475.     HDA_CODEC_ENTRY(0x83847617, "STAC9228", patch_stac927x),
  476.     HDA_CODEC_ENTRY(0x83847614, "STAC9229", patch_stac927x),
Add Comment
Please, Sign In to add comment